Update scrobble logic to post after 25% of the track has played, not 10 seconds.

This commit is contained in:
casey langen 2021-07-17 12:02:31 -07:00
parent c86230d3aa
commit 3cd6bc165f

View File

@ -508,13 +508,14 @@ void PlaybackService::OnTrackChanged(size_t pos, TrackPtr track) {
/* we consider a track to be played if (1) it enters the playing state and
it's less than 10 seconds long, or (2) it enters the playing state, and
remains playing for > 10 seconds */
remains playing for > 25% of its duration seconds */
const double duration = this->transport->GetDuration();
if (duration > 0 && duration < 10.0) {
this->MarkTrackAsPlayed(track->GetId());
}
else {
POST_DELAYED(this, MESSAGE_MARK_TRACK_PLAYED, track->GetId(), 0, 10000LL);
const int64_t delay = (int64_t)(duration * 0.25f);
POST_DELAYED(this, MESSAGE_MARK_TRACK_PLAYED, track->GetId(), 0, delay);
}
}