feat: add CreatedAt to albums (#159)

This change will make the GetAlbumList views with the "newest" type
work as expected.
This commit is contained in:
Duncan Overbruck
2021-10-04 20:12:49 +02:00
committed by GitHub
parent ea141cf7d0
commit 848d85d26a
16 changed files with 189 additions and 165 deletions

View File

@@ -15,6 +15,7 @@ func NewAlbumByFolder(f *db.Album) *Album {
Title: f.RightPath,
TrackCount: f.ChildCount,
Duration: f.Duration,
Created: f.CreatedAt,
}
if f.Cover != "" {
a.CoverID = f.SID()
@@ -28,7 +29,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
IsDir: true,
Title: f.RightPath,
ParentID: f.ParentSID(),
CreatedAt: f.UpdatedAt,
CreatedAt: f.CreatedAt,
}
if f.Cover != "" {
trCh.CoverID = f.SID()

View File

@@ -9,7 +9,7 @@ import (
func NewAlbumByTags(a *db.Album, artist *db.Artist) *Album {
ret := &Album{
Created: a.ModifiedAt,
Created: a.CreatedAt,
ID: a.SID(),
Name: a.TagTitle,
Year: a.TagYear,

View File

@@ -94,6 +94,7 @@ type Album struct {
CoverID *specid.ID `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
// browsing by folder (eg. getAlbumList)
Title string `xml:"title,attr,omitempty" json:"title"`
Album string `xml:"album,attr,omitempty" json:"album"`
@@ -103,7 +104,6 @@ type Album struct {
Name string `xml:"name,attr" json:"name"`
TrackCount int `xml:"songCount,attr" json:"songCount"`
Duration int `xml:"duration,attr" json:"duration"`
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`