Parcourir la source

[scrobbles] Try to fix mopidy double scrobbles

Colin Powell il y a 1 an
Parent
commit
beb9569663
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      vrobbler/apps/scrobbles/models.py

+ 4 - 0
vrobbler/apps/scrobbles/models.py

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