mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-17 07:38:46 +01:00
Small changes regarding StarredAt.
Making StarredAt more "precise", setting it to the time the change was detected. getStarred.view now returns albums ordered by StarredAt. loadRange method now take QueryOptions.Desc into account
This commit is contained in:
parent
4e3c848815
commit
db992a9941
8 changed files with 72 additions and 56 deletions
|
|
@ -106,9 +106,7 @@ func (b *browser) buildAlbumDir(al *domain.Album, tracks domain.MediaFiles) *Dir
|
|||
Parent: al.ArtistId,
|
||||
PlayCount: int32(al.PlayCount),
|
||||
UserRating: al.Rating,
|
||||
}
|
||||
if al.Starred {
|
||||
dir.Starred = al.UpdatedAt
|
||||
Starred: al.StarredAt,
|
||||
}
|
||||
|
||||
dir.Entries = make(Entries, len(tracks))
|
||||
|
|
|
|||
|
|
@ -46,59 +46,55 @@ var (
|
|||
)
|
||||
|
||||
func FromAlbum(al *domain.Album) Entry {
|
||||
c := Entry{}
|
||||
c.Id = al.Id
|
||||
c.Title = al.Name
|
||||
c.IsDir = true
|
||||
c.Parent = al.ArtistId
|
||||
c.Album = al.Name
|
||||
c.Year = al.Year
|
||||
c.Artist = al.AlbumArtist
|
||||
c.Genre = al.Genre
|
||||
c.CoverArt = al.CoverArtId
|
||||
if al.Starred {
|
||||
c.Starred = al.UpdatedAt
|
||||
}
|
||||
c.PlayCount = int32(al.PlayCount)
|
||||
c.Created = al.CreatedAt
|
||||
c.AlbumId = al.Id
|
||||
c.ArtistId = al.ArtistId
|
||||
c.UserRating = al.Rating
|
||||
c.Duration = al.Duration
|
||||
return c
|
||||
e := Entry{}
|
||||
e.Id = al.Id
|
||||
e.Title = al.Name
|
||||
e.IsDir = true
|
||||
e.Parent = al.ArtistId
|
||||
e.Album = al.Name
|
||||
e.Year = al.Year
|
||||
e.Artist = al.AlbumArtist
|
||||
e.Genre = al.Genre
|
||||
e.CoverArt = al.CoverArtId
|
||||
e.Starred = al.StarredAt
|
||||
e.PlayCount = int32(al.PlayCount)
|
||||
e.Created = al.CreatedAt
|
||||
e.AlbumId = al.Id
|
||||
e.ArtistId = al.ArtistId
|
||||
e.UserRating = al.Rating
|
||||
e.Duration = al.Duration
|
||||
return e
|
||||
}
|
||||
|
||||
func FromMediaFile(mf *domain.MediaFile) Entry {
|
||||
c := Entry{}
|
||||
c.Id = mf.Id
|
||||
c.Title = mf.Title
|
||||
c.IsDir = false
|
||||
c.Parent = mf.AlbumId
|
||||
c.Album = mf.Album
|
||||
c.Year = mf.Year
|
||||
c.Artist = mf.Artist
|
||||
c.Genre = mf.Genre
|
||||
c.Track = mf.TrackNumber
|
||||
c.Duration = mf.Duration
|
||||
c.Size = mf.Size
|
||||
c.Suffix = mf.Suffix
|
||||
c.BitRate = mf.BitRate
|
||||
if mf.Starred {
|
||||
c.Starred = mf.UpdatedAt
|
||||
}
|
||||
e := Entry{}
|
||||
e.Id = mf.Id
|
||||
e.Title = mf.Title
|
||||
e.IsDir = false
|
||||
e.Parent = mf.AlbumId
|
||||
e.Album = mf.Album
|
||||
e.Year = mf.Year
|
||||
e.Artist = mf.Artist
|
||||
e.Genre = mf.Genre
|
||||
e.Track = mf.TrackNumber
|
||||
e.Duration = mf.Duration
|
||||
e.Size = mf.Size
|
||||
e.Suffix = mf.Suffix
|
||||
e.BitRate = mf.BitRate
|
||||
e.Starred = mf.StarredAt
|
||||
if mf.HasCoverArt {
|
||||
c.CoverArt = mf.Id
|
||||
e.CoverArt = mf.Id
|
||||
}
|
||||
c.ContentType = mf.ContentType()
|
||||
c.Path = mf.Path
|
||||
c.PlayCount = int32(mf.PlayCount)
|
||||
c.DiscNumber = mf.DiscNumber
|
||||
c.Created = mf.CreatedAt
|
||||
c.AlbumId = mf.AlbumId
|
||||
c.ArtistId = mf.ArtistId
|
||||
c.Type = "music" // TODO Hardcoded for now
|
||||
c.UserRating = mf.Rating
|
||||
return c
|
||||
e.ContentType = mf.ContentType()
|
||||
e.Path = mf.Path
|
||||
e.PlayCount = int32(mf.PlayCount)
|
||||
e.DiscNumber = mf.DiscNumber
|
||||
e.Created = mf.CreatedAt
|
||||
e.AlbumId = mf.AlbumId
|
||||
e.ArtistId = mf.ArtistId
|
||||
e.Type = "music" // TODO Hardcoded for now
|
||||
e.UserRating = mf.Rating
|
||||
return e
|
||||
}
|
||||
|
||||
func FromAlbums(albums domain.Albums) Entries {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ func (g *listGenerator) GetRandom(offset int, size int) (Entries, error) {
|
|||
}
|
||||
|
||||
func (g *listGenerator) GetStarred(offset int, size int) (Entries, error) {
|
||||
qo := domain.QueryOptions{Offset: offset, Size: size}
|
||||
qo := domain.QueryOptions{Offset: offset, Size: size, Desc: true}
|
||||
albums, err := g.albumRepo.GetStarred(qo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue