Try to ignore duplicate geo scrobbles
This commit is contained in:
@ -674,6 +674,7 @@ class Scrobble(TimeStampedModel):
|
|||||||
) -> "Scrobble":
|
) -> "Scrobble":
|
||||||
|
|
||||||
media_class = media.__class__.__name__
|
media_class = media.__class__.__name__
|
||||||
|
dup = None
|
||||||
|
|
||||||
media_query = models.Q(track=media)
|
media_query = models.Q(track=media)
|
||||||
if media_class == "Track":
|
if media_class == "Track":
|
||||||
@ -699,6 +700,15 @@ class Scrobble(TimeStampedModel):
|
|||||||
if media_class == "GeoLocation":
|
if media_class == "GeoLocation":
|
||||||
media_query = models.Q(geo_location=media)
|
media_query = models.Q(geo_location=media)
|
||||||
scrobble_data["geo_location_id"] = media.id
|
scrobble_data["geo_location_id"] = media.id
|
||||||
|
dup = cls.objects.filter(
|
||||||
|
media_type=cls.MEDIA_TYPE.GeoLocation,
|
||||||
|
timestamp = scrobble_data.get("timestamp"),
|
||||||
|
).first()
|
||||||
|
|
||||||
|
if dup:
|
||||||
|
logger.info("[scrobbling] scrobble with identical timestamp found")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
scrobble = (
|
scrobble = (
|
||||||
cls.objects.filter(
|
cls.objects.filter(
|
||||||
@ -709,6 +719,7 @@ class Scrobble(TimeStampedModel):
|
|||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if scrobble and scrobble.can_be_updated:
|
if scrobble and scrobble.can_be_updated:
|
||||||
source = scrobble_data["source"]
|
source = scrobble_data["source"]
|
||||||
mtype = media.__class__.__name__
|
mtype = media.__class__.__name__
|
||||||
|
|||||||
Reference in New Issue
Block a user