newgiin / cloudplayer-scrobbler

Chrome plugin for scrobbling from Google Play (music.google.com)
52 stars 15 forks source link

Wrong track duration #42

Open zimensky opened 6 years ago

zimensky commented 6 years ago

Recently I've noticed that some tracks doesn't scrobble. I've started to look up what data's been sent and found that somehow updateNowPlaying sents duration of a previously played track. Sometimes tracks been scrobbled OK, but sometimes they're not.

Possible cause of missing scrobbles although I can't reproduce it 100%.

Plugin version: 1.7.0

Examples

Please, take a look at tracks duration — each time updateNowPlaying sents duration of previous track:

screenshot_3

Summer Montage

Actual duration: 124 (2:04) Sent duration: 257 (4:17)

method:track.updateNowPlaying
track:Summer Montage / Madeline
artist:Justin Hurwitz
duration:257

City Of Stars

Actual duration: 149 (2:29) Sent duration: 124 (2:04)

method:track.updateNowPlaying
track:City Of Stars (From "La La Land" Soundtrack)
artist:Ryan Gosling
duration:124
zimensky commented 6 years ago

So, I've

I've listened to first track, then second track begin to play and duration was off first track.

And also I've got a missing scrobble of a track which actual duration is less than a sent duration value.

zimensky commented 6 years ago

GooglePlay tab won't render any track time relative updates to HTML if it's not the active tab. So if you rely on track duration and its current position this data won't be updated with a new track playing.

newgiin commented 6 years ago

Active tab as in currently in focus? I usually have the music tab running in the background and seems to scrobble as expected. I'll look into this this weekend.

zimensky commented 6 years ago

Yes, active tab as in currently in focus.

I've just tried to make an extension that checks an info about currently playing song on Google Pay and discovered that a song time only being updated if Google Play tab's in focus. As soon as you switch to another tab time numbers stop being updated (in DOM, I mean, both in the track progress/duration block and the progress bar attributes data). Although a song title and an artist DOM elements being updated right away on a song change.

You can also check it via your extension: just watch the XHR requests on updateNowPlaying in the extension's background script — when not on the Google Play tab for all the songs there will be "frozen" duration of a track, which were playing while you were on the Google Play tab.

zimensky commented 6 years ago

By the way, I've discovered that there's no any problems with scrobbling if you keep Google Play in a single tab in a separate Chrome window. That way the tab is always stays active (even if the window is not) and updates all necessary data in the DOM.