Update ServeGetAlbumList to reflect @Duncaen's changes
This commit is contained in:
@@ -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").
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user