Fix scrobble spam from Jellyfin

The issue here was that we update a Jellyfin scrobble to be complete
when it hits a certain threshold of percentage played (90) and then we
stop finding that scrobble while the video finishes playing. This
happens over and over again, so once a video reaches 90 percent played
we get dozens more scrobbles for each update as the video finishes
playing.

This is a crude fix, for the spam, as we'll end up "resuming" videos
that are stopped at 95 percent. So we need some way to mark the scrobble
as complete.  I think forcing the percent to 100 on finish might work.
This commit is contained in:
2023-01-17 10:55:56 -05:00
parent 9d4db65b3c
commit 77362d3207

View File

@ -83,12 +83,11 @@ class Scrobble(TimeStampedModel):
cls.objects.filter(
video=video,
user_id=user_id,
played_to_completion=False,
)
.order_by('-modified')
.first()
)
if scrobble:
if scrobble and scrobble.playback_perecnt <= 100:
logger.info(
f"Found existing scrobble for video {video}, updating",
{"scrobble_data": scrobble_data},