scrobblerlog: fix listen export not considering latest timestamp

This commit is contained in:
Philipp Wolfer 2025-05-01 14:09:12 +02:00
parent 443734e4c7
commit cfc3cd522d
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B

View file

@ -151,9 +151,12 @@ func (b *ScrobblerLogBackend) ExportListens(oldestTimestamp time.Time, results c
listens := make(models.ListensList, 0, len(b.log.Records))
client := strings.Split(b.log.Client, " ")[0]
for _, record := range b.log.Records {
listens = append(listens, recordToListen(record, client))
listen := recordToListen(record, client)
if listen.ListenedAt.After(oldestTimestamp) {
listens = append(listens, recordToListen(record, client))
}
}
sort.Sort(listens.NewerThan(oldestTimestamp))
sort.Sort(listens)
progress <- models.Progress{Total: int64(len(listens))}.Complete()
results <- models.ListensResult{Items: listens}
}