mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-10 10:17:04 +02:00
scrobblerlog: fix listen export not considering latest timestamp
This commit is contained in:
parent
443734e4c7
commit
cfc3cd522d
1 changed files with 5 additions and 2 deletions
|
@ -151,9 +151,12 @@ func (b *ScrobblerLogBackend) ExportListens(oldestTimestamp time.Time, results c
|
||||||
listens := make(models.ListensList, 0, len(b.log.Records))
|
listens := make(models.ListensList, 0, len(b.log.Records))
|
||||||
client := strings.Split(b.log.Client, " ")[0]
|
client := strings.Split(b.log.Client, " ")[0]
|
||||||
for _, record := range b.log.Records {
|
for _, record := range b.log.Records {
|
||||||
|
listen := recordToListen(record, client)
|
||||||
|
if listen.ListenedAt.After(oldestTimestamp) {
|
||||||
listens = append(listens, recordToListen(record, client))
|
listens = append(listens, recordToListen(record, client))
|
||||||
}
|
}
|
||||||
sort.Sort(listens.NewerThan(oldestTimestamp))
|
}
|
||||||
|
sort.Sort(listens)
|
||||||
progress <- models.Progress{Total: int64(len(listens))}.Complete()
|
progress <- models.Progress{Total: int64(len(listens))}.Complete()
|
||||||
results <- models.ListensResult{Items: listens}
|
results <- models.ListensResult{Items: listens}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue