Update ServeGetAlbumList to reflect @Duncaen's changes

This commit is contained in:
sentriz
2020-07-24 14:29:02 +01:00
parent 365bfa9c59
commit f16f07b8a8
2 changed files with 2 additions and 1 deletions

View File

@@ -131,7 +131,7 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
// TODO: think about removing this extra join to count number // TODO: think about removing this extra join to count number
// of children. it might make sense to store that in the db // of children. it might make sense to store that in the db
q. q.
Select("albums.*, count(tracks.id) child_count"). Select("albums.*, count(tracks.id) child_count, sum(tracks.length) duration").
Joins("LEFT JOIN tracks ON tracks.album_id=albums.id"). Joins("LEFT JOIN tracks ON tracks.album_id=albums.id").
Group("albums.id"). Group("albums.id").
Where("albums.tag_artist_id IS NOT NULL"). Where("albums.tag_artist_id IS NOT NULL").

View File

@@ -14,6 +14,7 @@ func NewAlbumByFolder(f *db.Album) *Album {
ParentID: f.ParentSID(), ParentID: f.ParentSID(),
Title: f.RightPath, Title: f.RightPath,
TrackCount: f.ChildCount, TrackCount: f.ChildCount,
Duration: f.Duration,
} }
if f.Cover != "" { if f.Cover != "" {
a.CoverID = f.SID() a.CoverID = f.SID()