Fix bug with duplicate Jellyfin scrobbles

This commit is contained in:
2023-01-10 23:47:26 -05:00
parent d0c88ce271
commit 2b81b28bff
5 changed files with 65 additions and 29 deletions

View File

@ -58,7 +58,8 @@ class Video(TimeStampedModel):
imdb_id = models.CharField(max_length=20, **BNULL)
tvrage_id = models.CharField(max_length=20, **BNULL)
# Metadata fields from TMDB
class Meta:
unique_together = [['title', 'imdb_id']]
def __str__(self):
if self.video_type == self.VideoType.TV_EPISODE:
@ -107,6 +108,7 @@ class Video(TimeStampedModel):
video_dict["season_number"] = data_dict.get("SeasonNumber", "")
video, created = cls.objects.get_or_create(**video_dict)
if created:
logger.debug(f"Created new video: {video}")
else: