[scrobbles] Try to fix mopidy double scrobbles

This commit is contained in:
2024-03-08 14:52:01 -05:00
parent efcf01b49f
commit beb9569663

View File

@ -829,6 +829,7 @@ class Scrobble(TimeStampedModel):
) )
source = scrobble_data["source"] source = scrobble_data["source"]
mtype = media.__class__.__name__ mtype = media.__class__.__name__
mopidy_status = scrobble_data.get("mopidy_status", None)
logger.info( logger.info(
f"[scrobbling] check for existing scrobble to update ", f"[scrobbling] check for existing scrobble to update ",
@ -853,6 +854,9 @@ class Scrobble(TimeStampedModel):
) )
return scrobble return scrobble
if mopidy_status == "stopped":
scrobble.stop()
if scrobble and scrobble.can_be_updated: if scrobble and scrobble.can_be_updated:
return scrobble.update(scrobble_data) return scrobble.update(scrobble_data)