[scrobbles] source_id is screwing things up

This commit is contained in:
2026-03-14 02:00:36 -04:00
parent c0659f26a5
commit 2e289f3852

View File

@ -1163,24 +1163,24 @@ class Scrobble(TimeStampedModel):
# If source_id is provided (e.g., MediaSourceId from Jellyfin), check for existing scrobble first # If source_id is provided (e.g., MediaSourceId from Jellyfin), check for existing scrobble first
# This prevents duplicates when webhooks arrive faster than scrobble creation # This prevents duplicates when webhooks arrive faster than scrobble creation
if source_id: # if source_id:
existing_by_source_id = cls.objects.filter( # existing_by_source_id = cls.objects.filter(
media_query, # media_query,
user_id=user_id, # user_id=user_id,
source_id=source_id, # source_id=source_id,
).first() # ).first()
if existing_by_source_id: # if existing_by_source_id:
logger.info( # logger.info(
"[create_or_update] found existing scrobble by source_id, updating", # "[create_or_update] found existing scrobble by source_id, updating",
extra={ # extra={
"scrobble_id": existing_by_source_id.id, # "scrobble_id": existing_by_source_id.id,
"source_id": source_id, # "source_id": source_id,
}, # },
) # )
scrobble_data["playback_status"] = scrobble_data.pop( # scrobble_data["playback_status"] = scrobble_data.pop(
"status", None # "status", None
) # )
return existing_by_source_id.update(scrobble_data) # return existing_by_source_id.update(scrobble_data)
# Find our last scrobble of this media item (track, video, etc) # Find our last scrobble of this media item (track, video, etc)
scrobble = ( scrobble = (