don't give a cover id for a cover that doesn't exist

This commit is contained in:
sentriz
2019-06-06 16:39:35 +01:00
parent 448ca67991
commit 51bb3b6ea5
18 changed files with 157 additions and 96 deletions

View File

@@ -19,20 +19,20 @@ func newAlbumByFolder(f *model.Album) *subsonic.Album {
}
func newTCAlbumByFolder(f *model.Album, parent *model.Album) *subsonic.TrackChild {
child := &subsonic.TrackChild{
CoverID: f.ID,
ID: f.ID,
IsDir: true,
Title: f.RightPath,
trCh := &subsonic.TrackChild{
ID: f.ID,
IsDir: true,
Title: f.RightPath,
ParentID: f.ParentID,
}
if parent != nil {
child.ParentID = parent.ID
if f.Cover != "" {
trCh.CoverID = f.ID
}
return child
return trCh
}
func newTCTrackByFolder(t *model.Track, parent *model.Album) *subsonic.TrackChild {
return &subsonic.TrackChild{
trCh := &subsonic.TrackChild{
ID: t.ID,
Album: t.Album.RightPath,
ContentType: t.MIME(),
@@ -47,12 +47,15 @@ func newTCTrackByFolder(t *model.Track, parent *model.Album) *subsonic.TrackChil
t.Filename,
),
ParentID: parent.ID,
CoverID: parent.ID,
Duration: t.Duration,
Bitrate: t.Bitrate,
IsDir: false,
Type: "music",
}
if parent.Cover != "" {
trCh.CoverID = parent.ID
}
return trCh
}
func newArtistByFolder(f *model.Album) *subsonic.Artist {