fix(subsonic): don't return concatenated genres strings for song/trackchilds

This commit is contained in:
sentriz
2023-10-10 16:40:10 +01:00
parent 422a4b88d7
commit f18151b755
5 changed files with 76 additions and 55 deletions

View File

@@ -2,7 +2,6 @@ package spec
import (
"path/filepath"
"strings"
"go.senan.xyz/gonic/db"
)
@@ -69,7 +68,6 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
),
ParentID: parent.SID(),
Duration: t.Length,
Genre: strings.Join(t.GenreStrings(), ", "),
Year: parent.TagYear,
Bitrate: t.Bitrate,
IsDir: false,
@@ -92,6 +90,12 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
if t.TrackRating != nil {
trCh.UserRating = t.TrackRating.Rating
}
if len(t.Genres) > 0 {
trCh.Genre = t.Genres[0].Name
}
for _, g := range t.Genres {
trCh.Genres = append(trCh.Genres, &GenreRef{Name: g.Name})
}
return trCh
}