Adding big list of mime types, and adding support for contenty-type in
getMusicDirectory.view
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/deluan/gosonic/domain"
|
"github.com/deluan/gosonic/domain"
|
||||||
"github.com/deluan/gosonic/utils"
|
"github.com/deluan/gosonic/utils"
|
||||||
"github.com/karlkfi/inject"
|
"github.com/karlkfi/inject"
|
||||||
|
"mime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetMusicDirectoryController struct {
|
type GetMusicDirectoryController struct {
|
||||||
@@ -82,6 +83,7 @@ func (c *GetMusicDirectoryController) buildAlbumDir(al *domain.Album, tracks []d
|
|||||||
if mf.HasCoverArt {
|
if mf.HasCoverArt {
|
||||||
dir.Child[i].CoverArt = mf.Id
|
dir.Child[i].CoverArt = mf.Id
|
||||||
}
|
}
|
||||||
|
dir.Child[i].ContentType = mime.TypeByExtension("." + mf.Suffix)
|
||||||
}
|
}
|
||||||
return dir
|
return dir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package conf
|
||||||
|
|
||||||
|
import "mime"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
mt := map[string]string{
|
||||||
|
".mp3": "audio/mpeg",
|
||||||
|
".ogg": "audio/ogg",
|
||||||
|
".oga": "audio/ogg",
|
||||||
|
".opus": "audio/ogg",
|
||||||
|
".ogx": "application/ogg",
|
||||||
|
".aac": "audio/mp4",
|
||||||
|
".m4a": "audio/mp4",
|
||||||
|
".flac": "audio/flac",
|
||||||
|
".wav": "audio/x-wav",
|
||||||
|
".wma": "audio/x-ms-wma",
|
||||||
|
".ape": "audio/x-monkeys-audio",
|
||||||
|
".mpc": "audio/x-musepack",
|
||||||
|
".shn": "audio/x-shn",
|
||||||
|
".flv": "video/x-flv",
|
||||||
|
".avi": "video/avi",
|
||||||
|
".mpg": "video/mpeg",
|
||||||
|
".mpeg": "video/mpeg",
|
||||||
|
".mp4": "video/mp4",
|
||||||
|
".m4v": "video/x-m4v",
|
||||||
|
".mkv": "video/x-matroska",
|
||||||
|
".mov": "video/quicktime",
|
||||||
|
".wmv": "video/x-ms-wmv",
|
||||||
|
".ogv": "video/ogg",
|
||||||
|
".divx": "video/divx",
|
||||||
|
".m2ts": "video/MP2T",
|
||||||
|
".ts": "video/MP2T",
|
||||||
|
".webm": "video/webm",
|
||||||
|
".gif": "image/gif",
|
||||||
|
".jpg": "image/jpeg",
|
||||||
|
".jpeg": "image/jpeg",
|
||||||
|
".png": "image/png",
|
||||||
|
".bmp": "image/bmp",
|
||||||
|
}
|
||||||
|
|
||||||
|
for ext, typ := range mt {
|
||||||
|
mime.AddExtensionType(ext, typ)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user