Fixes Compliance Issue With ListenBrainz API
According to The Official ListenBrainz Documentation (page 89), the duration of a song is either duration and duration_ms, but not both. Maloja was only looking for duration and this caused issues with Navidrome as it reported duration_ms instead of duration so it would always be null. This would correct that issue.
On second thought, in order to align more closely with Spotify request, I changed track_length to scrobble_duration which seems more likely to fit. Example from Navidrome:
{
"time": 1733757481,
"track": {
"artists": [
"Kazumi Totaka"
],
"title": "Bees!",
"album": {
"artists": [
"Kazumi Totaka"
],
"albumtitle": "Animal Crossing"
},
"length": null
},
"duration": 38560,
"origin": "client:navidrome"
},
Example from Spotify:
{
"time": 1733744505,
"track": {
"artists": [
"Ethan Slater",
"Marissa Bode",
"Ariana Grande",
"Cynthia Erivo",
"Jonathan Bailey"
],
"title": "Dancing Through Life",
"album": {
"artists": [
"Ariana Grande",
"Cynthia Erivo",
"Wicked Movie Cast"
],
"albumtitle": "Wicked: The Soundtrack"
},
"length": 587
},
"duration": 586,
"origin": "client:spotify"
},
track_length refers to the actual full track, while scrobble_duration means how long it was listened to in this specific scrobble (ended early, skipped ahead etc.). The documentation to me sounds like it refers to the full track duration, is that not how it's used?