remove globals

This commit is contained in:
sentriz
2020-05-03 04:43:00 +01:00
parent 9bf80f4b18
commit ee9335f71e
11 changed files with 188 additions and 163 deletions

View File

@@ -1,11 +1,18 @@
package mime
var Types = map[string]string{
"mp3": "audio/mpeg",
"flac": "audio/x-flac",
"aac": "audio/x-aac",
"m4a": "audio/m4a",
"m4b": "audio/m4b",
"ogg": "audio/ogg",
"opus": "audio/ogg",
// this package is at such a high level in the hierarchy because
// it's used by both `server/db` and `server/scanner`
func FromExtension(ext string) (string, bool) {
types := map[string]string{
"mp3": "audio/mpeg",
"flac": "audio/x-flac",
"aac": "audio/x-aac",
"m4a": "audio/m4a",
"m4b": "audio/m4b",
"ogg": "audio/ogg",
"opus": "audio/ogg",
}
v, ok := types[ext]
return v, ok
}