FoxxMD / multi-scrobbler

Scrobble plays from multiple sources to multiple clients
https://foxxmd.github.io/multi-scrobbler
MIT License
334 stars 17 forks source link

[Spotify] Scrobble time should be the when the song started, like other sources #167

Closed Magikh42 closed 2 weeks ago

Magikh42 commented 1 month ago

Hello, I found an inconsistency when scrobbling from Spotify For other sources the scrobble time is when the song started but for Spotify it is when it ended

To Reproduce Scrobble a song from Spotify to Maloja, scrobble time will be when the song ended

Expected behavior For other sources (Webscrobbler or Pano Scrobbler) it is when it started

Logs

[2024-07-18 00:05:56.941 +0000] DEBUG  : [App] [Scrobblers] [Maloja - maloja-magikh] Raw Payload:
[2024-07-18 00:05:56.938 +0000] INFO   : [App] [Scrobblers] [Maloja - maloja-magikh] Scrobbled (New)     => (Spotify) Vexento - With You @ 2024-07-18T00:05:56+00:00 (C)
[2024-07-18 00:05:56.784 +0000] DEBUG  : [App] [Scrobblers] [Maloja - maloja-magikh] Found 40 recent scrobbles
[2024-07-18 00:05:56.690 +0000] DEBUG  : [App] [Scrobblers] [Maloja - maloja-magikh] Refreshing recent scrobbles
[2024-07-18 00:05:56.687 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:05:56+00:00 | Next check interval: 20.00s
[2024-07-18 00:05:56.681 +0000] INFO   : [App] [Sources] [Spotify - spotify] Discovered => Vexento - With You @ 2024-07-18T00:05:56+00:00 (C)
[2024-07-18 00:05:56.671 +0000] VERBOSE: [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] (7IYlkuG1SxHaCePFq0375u) Vexento - With You added after met thresholds with tracked time of 204.20s (wanted 240s) and tracked percent of 97.00% (wanted 50%) and not matching any prior plays
[2024-07-18 00:05:56.666 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Started new Player listen range.
[2024-07-18 00:05:56.662 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] New Play: (0tIKE84r8SnFMoCM5WfLNG) Vexento - Eyes Closed
[2024-07-18 00:05:56.661 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Generating play object with playDateCompleted
[2024-07-18 00:05:56.659 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Ended current Player listen range.
[2024-07-18 00:05:56.657 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Incoming play state ((0tIKE84r8SnFMoCM5WfLNG) Vexento - Eyes Closed) does not match existing state, removing existing: (7IYlkuG1SxHaCePFq0375u) Vexento - With You
[2024-07-18 00:05:56.537 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:05:55.533 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:05:55+00:00 | Next check interval: 1.00s
[2024-07-18 00:05:55.532 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:05:55.531 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Temporarily decreasing polling interval to 1.00s due to Player 2498e50f68-DESKTOP-MAGI-SingleUser reporting track duration remaining (1.11s) less than normal interval (20.00s)
[2024-07-18 00:05:55.419 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:05:54.415 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:05:54+00:00 | Next check interval: 1.00s
[2024-07-18 00:05:54.413 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:05:54.409 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Temporarily decreasing polling interval to 1.00s due to Player 2498e50f68-DESKTOP-MAGI-SingleUser reporting track duration remaining (2.25s) less than normal interval (20.00s)
[2024-07-18 00:05:54.275 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:05:34.231 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:05:34+00:00 | Next check interval: 20.00s
[2024-07-18 00:05:34.224 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:05:34.072 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:05:14.021 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:05:14+00:00 | Next check interval: 20.00s
[2024-07-18 00:05:14.018 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:05:13.863 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:04:53.823 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:04:53+00:00 | Next check interval: 20.00s
[2024-07-18 00:04:53.821 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:04:53.686 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:04:33.650 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:04:33+00:00 | Next check interval: 20.00s
[2024-07-18 00:04:33.646 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:04:33.514 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:04:13.469 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:04:13+00:00 | Next check interval: 20.00s
[2024-07-18 00:04:13.465 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:04:13.305 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:03:53.266 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:03:53+00:00 | Next check interval: 20.00s
[2024-07-18 00:03:53.258 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:03:53.057 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:03:33.017 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:03:33+00:00 | Next check interval: 20.00s
[2024-07-18 00:03:33.011 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:03:32.895 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:03:12.853 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:03:12+00:00 | Next check interval: 20.00s
[2024-07-18 00:03:12.850 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:03:12.746 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:02:52.708 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:02:52+00:00 | Next check interval: 20.00s
[2024-07-18 00:02:52.705 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:02:52.693 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Player position changed between current -> last update. Updated calculated status to playing
[2024-07-18 00:02:52.495 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:02:32.457 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:02:32+00:00 | Next check interval: 20.00s
[2024-07-18 00:02:32.456 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] No new tracks discovered
[2024-07-18 00:02:32.452 +0000] VERBOSE: [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] (1lGwJMyc2w9c472dxTRIR4) Vexento - Around The Fire not added because did not meet thresholds with tracked time of 0.00s (wanted 240s) and tracked percent of 0.00% (wanted 50%).
[2024-07-18 00:02:32.451 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Started new Player listen range.
[2024-07-18 00:02:32.450 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] New Play: (7IYlkuG1SxHaCePFq0375u) Vexento - With You
[2024-07-18 00:02:32.450 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Generating play object with playDateCompleted
[2024-07-18 00:02:32.448 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] [Player 2498e50f68-DESKTOP-MAGI-SingleUser] Incoming play state ((7IYlkuG1SxHaCePFq0375u) Vexento - With You) does not match existing state, removing existing: (1lGwJMyc2w9c472dxTRIR4) Vexento - Around The Fire
[2024-07-18 00:02:32.323 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Refreshing recently played
[2024-07-18 00:02:12.282 +0000] DEBUG  : [App] [Sources] [Spotify - spotify] Last activity was at 2024-07-18T00:02:12+00:00 | Next check interval: 20.00s

Versions (please complete the following information):

Additional context I think removing the played duration from the timestamp would solve this problem

FoxxMD commented 1 month ago

Thanks for the writeup.

For other sources (Webscrobbler or Pano Scrobbler) it is when it started

Not arguing against this (it definitely should be consistent) but I've always found it hard to find documented evidence saying "Scrobbles should be timestamped when track is (started/stopped)". The "official" lastfm docs on scrobbling only describe when a scrobble can occur but not what the timestamp for the scrobble should be.

Do you have a link for either webscrobbler or pano specifying the timestamp? Or is it just anecdotal?

Magikh42 commented 1 month ago

It's just something I found from experience using these scrobblers Even if it not standard I think it would be a good thing to uniformize the default behaviour, especially for users using multiple sources, or at least have the option to select either beginning or end of the song the time of the scrobble

FoxxMD commented 1 month ago

While I agree I actually realized why it is this way and its definitely on purpose. I'd forgotten :sweat_smile:

Spotify timestamps their own listening history when you finish listening to a track. To ensure that MS does not duplicate scrobbles when backlogging on startup -- that is, when it compares historical scrobbles from Spotify against your scrobbles in Maloja, etc... -- the timestamp MS uses is as close to the one Spotify uses.

You can see which MS is using by looking for (S) or (C) at the end of scrobble data

image

I'll be adding this tip to the UI

FoxxMD commented 2 weeks ago

Timestamp tooltip is released in v0.8.2.