fix(subsonic): send valid content-type with http.ServeStream

This commit is contained in:
sentriz
2022-12-26 18:26:13 +00:00
parent 63f7b05b07
commit 8dc58c71a4
8 changed files with 52 additions and 51 deletions

View File

@@ -56,7 +56,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
trCh := &TrackChild{
ID: t.SID(),
ContentType: t.MIME(),
Suffix: t.Ext(),
Suffix: formatExt(t.Ext()),
Size: t.Size,
Artist: t.TagTrackArtist,
Title: t.TagTitle,

View File

@@ -38,7 +38,7 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
ret := &TrackChild{
ID: t.SID(),
ContentType: t.MIME(),
Suffix: t.Ext(),
Suffix: formatExt(t.Ext()),
ParentID: t.AlbumSID(),
CreatedAt: t.CreatedAt,
Size: t.Size,

View File

@@ -36,7 +36,7 @@ func NewPodcastEpisode(e *db.PodcastEpisode) *PodcastEpisode {
Genre: "Podcast",
Duration: e.Length,
Year: e.PublishDate.Year(),
Suffix: e.Ext(),
Suffix: formatExt(e.Ext()),
BitRate: e.Bitrate,
IsDir: false,
Path: e.Path,

View File

@@ -2,6 +2,7 @@ package spec
import (
"fmt"
"strings"
"time"
"go.senan.xyz/gonic"
@@ -422,3 +423,7 @@ func formatRating(rating float64) string {
}
return fmt.Sprintf("%.2f", rating)
}
func formatExt(ext string) string {
return strings.TrimPrefix(ext, ".")
}