feat: render local artist images with no foreign key

This commit is contained in:
sentriz
2022-02-09 17:55:19 +00:00
committed by Senan Kelly
parent a0b9934d08
commit a74b5a261c
10 changed files with 160 additions and 49 deletions

View File

@@ -76,11 +76,15 @@ func NewArtistByFolder(f *db.Album) *Artist {
// an album is also a folder. so we're constructing an artist
// from an "album" where
// maybe TODO: rename the Album model to Folder
return &Artist{
a := &Artist{
ID: f.SID(),
Name: f.RightPath,
AlbumCount: f.ChildCount,
}
if f.Cover != "" {
a.CoverID = f.SID()
}
return a
}
func NewDirectoryByFolder(f *db.Album, children []*TrackChild) *Directory {

View File

@@ -72,11 +72,15 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
}
func NewArtistByTags(a *db.Artist) *Artist {
return &Artist{
r := &Artist{
ID: a.SID(),
Name: a.Name,
AlbumCount: a.AlbumCount,
}
if a.Cover != "" {
r.CoverID = a.SID()
}
return r
}
func NewGenre(g *db.Genre) *Genre {