[scrobbles] Try to fix mopidy double scrobble
This commit is contained in:
@ -829,6 +829,9 @@ class Scrobble(TimeStampedModel):
|
|||||||
)
|
)
|
||||||
source = scrobble_data["source"]
|
source = scrobble_data["source"]
|
||||||
mtype = media.__class__.__name__
|
mtype = media.__class__.__name__
|
||||||
|
playback_status = scrobble_data.get(
|
||||||
|
"mopidy_status", scrobble_data.get("jellyfin_status", None)
|
||||||
|
)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"[scrobbling] check for existing scrobble to update ",
|
f"[scrobbling] check for existing scrobble to update ",
|
||||||
@ -836,7 +839,6 @@ class Scrobble(TimeStampedModel):
|
|||||||
"scrobble_id": scrobble.id if scrobble else None,
|
"scrobble_id": scrobble.id if scrobble else None,
|
||||||
"media_type": mtype,
|
"media_type": mtype,
|
||||||
"media_id": media.id,
|
"media_id": media.id,
|
||||||
"source": source,
|
|
||||||
"scrobble_data": scrobble_data,
|
"scrobble_data": scrobble_data,
|
||||||
"percent_played": scrobble.percent_played
|
"percent_played": scrobble.percent_played
|
||||||
if scrobble
|
if scrobble
|
||||||
@ -854,7 +856,11 @@ class Scrobble(TimeStampedModel):
|
|||||||
)
|
)
|
||||||
return scrobble
|
return scrobble
|
||||||
|
|
||||||
if scrobble and scrobble.can_be_updated:
|
if (
|
||||||
|
scrobble
|
||||||
|
and scrobble.can_be_updated
|
||||||
|
and playback_status != "stopped"
|
||||||
|
):
|
||||||
return scrobble.update(scrobble_data)
|
return scrobble.update(scrobble_data)
|
||||||
|
|
||||||
# Discard status before creating
|
# Discard status before creating
|
||||||
|
|||||||
Reference in New Issue
Block a user