subsonic: fixed filtering songs based on timestamp

This commit is contained in:
Philipp Wolfer 2023-12-01 11:48:23 +01:00
parent 8a1cd8ded7
commit a4a05ea047
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B

View file

@ -66,11 +66,11 @@ func (b *SubsonicApiBackend) ExportLoves(oldestTimestamp time.Time, results chan
} }
func (b *SubsonicApiBackend) filterSongs(songs []*subsonic.Child, oldestTimestamp time.Time) models.LovesList { func (b *SubsonicApiBackend) filterSongs(songs []*subsonic.Child, oldestTimestamp time.Time) models.LovesList {
loves := make(models.LovesList, len(songs)) loves := make(models.LovesList, 0, len(songs))
for i, song := range songs { for _, song := range songs {
love := SongAsLove(*song, b.client.User) love := SongAsLove(*song, b.client.User)
if love.Created.Unix() > oldestTimestamp.Unix() { if love.Created.Unix() > oldestTimestamp.Unix() {
loves[i] = love loves = append(loves, love)
} }
} }