mopidy-scrobbler icon indicating copy to clipboard operation
mopidy-scrobbler copied to clipboard

Time position at the end of playback is considered to be total time played

Open nouste opened this issue 8 years ago • 3 comments

The extension does not count the actual time a track has been played, but only checks the time position at the end of playback to do the math. The problem in this approach is that after a track has started to play and someone jumps past the half duration of the track (or past 240 seconds) and then skips to next track, the track will be scrobbled no matter how long it has been played.

I found this issue when I had a couple of new albums on my playlist which I just quickly skipped through while listening a few seconds here and there from each track. To my surprise I later noticed that all of the tracks had been scrobbled.

nouste avatar Nov 04 '15 19:11 nouste

Indeed, we would need much better book keeping to get this right. Probably we can do something like the following:

on-track-start:
  last_position = 0
  played_time = 0

on-seek:
  played_time += current_position - last_position
  last_position = seek_position

on-track-change:
  played_time += current_position - last_position
  if played_time > ...:
    scrobble()

adamcik avatar Nov 15 '15 20:11 adamcik

We could also consider if this is something that mopidy should / could keep track of instead of leaving it to extensions.

adamcik avatar Nov 15 '15 23:11 adamcik

Having looked at this due to other reason, I don't think we have a sane way of getting current_position without changing something in core.

adamcik avatar Nov 21 '15 22:11 adamcik