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:
@ -83,12 +83,11 @@ class Scrobble(TimeStampedModel):
|
|||||||
cls.objects.filter(
|
cls.objects.filter(
|
||||||
video=video,
|
video=video,
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
played_to_completion=False,
|
|
||||||
)
|
)
|
||||||
.order_by('-modified')
|
.order_by('-modified')
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
if scrobble:
|
if scrobble and scrobble.playback_perecnt <= 100:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Found existing scrobble for video {video}, updating",
|
f"Found existing scrobble for video {video}, updating",
|
||||||
{"scrobble_data": scrobble_data},
|
{"scrobble_data": scrobble_data},
|
||||||
|
|||||||
Reference in New Issue
Block a user