mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 21:57:06 +02:00
Unified code for backend clients and tests
This commit is contained in:
parent
9316838d59
commit
aa01ae1342
11 changed files with 220 additions and 42 deletions
|
@ -63,7 +63,7 @@ out:
|
|||
|
||||
for _, listen := range result.Payload.Listens {
|
||||
if listen.ListenedAt > oldestTimestamp.Unix() {
|
||||
listens = append(listens, ListenFromListenBrainz(listen))
|
||||
listens = append(listens, listen.ToListen())
|
||||
} else {
|
||||
// result contains listens older then oldestTimestamp,
|
||||
// we can stop requesting more
|
||||
|
@ -76,7 +76,7 @@ out:
|
|||
return listens, nil
|
||||
}
|
||||
|
||||
func ListenFromListenBrainz(lbListen Listen) models.Listen {
|
||||
func (lbListen Listen) ToListen() models.Listen {
|
||||
track := lbListen.TrackMetadata
|
||||
listen := models.Listen{
|
||||
ListenedAt: time.Unix(lbListen.ListenedAt, 0),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue