fix(subsonic): send valid content-type with http.ServeStream
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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, ".")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user