From 31d3a85e8c0e247ff58e44aee6a37469aa69aa40 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Fri, 13 Mar 2026 15:54:57 -0400 Subject: [PATCH] [videos] Dont always lookup from IMDB --- vrobbler/apps/videos/models.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/vrobbler/apps/videos/models.py b/vrobbler/apps/videos/models.py index 55cec78..72719b4 100644 --- a/vrobbler/apps/videos/models.py +++ b/vrobbler/apps/videos/models.py @@ -178,13 +178,17 @@ class Series(TimeStampedModel): def last_scrobbled_episode(self, user_id: int) -> Optional["Video"]: episode = None - last_scrobble = self.scrobbles_for_user(user_id, include_playing=True).first() + last_scrobble = self.scrobbles_for_user( + user_id, include_playing=True + ).first() if last_scrobble: episode = last_scrobble.media_obj return episode def is_episode_playing(self, user_id: int) -> bool: - last_scrobble = self.scrobbles_for_user(user_id, include_playing=True).first() + last_scrobble = self.scrobbles_for_user( + user_id, include_playing=True + ).first() return not last_scrobble.played_to_completion def fix_metadata(self, force_update=False): @@ -359,7 +363,9 @@ class Video(ScrobblableMixin): self.cover_image.save(fname, ContentFile(r.content), save=True) @classmethod - def get_from_youtube_id(cls, youtube_id: str, overwrite: bool = False) -> "Video": + def get_from_youtube_id( + cls, youtube_id: str, overwrite: bool = False + ) -> "Video": video, created = cls.objects.get_or_create(youtube_id=youtube_id) if not created and not overwrite: return video @@ -379,7 +385,9 @@ class Video(ScrobblableMixin): return video @classmethod - def get_from_imdb_id(cls, imdb_id: str, overwrite: bool = False) -> "Video": + def get_from_imdb_id( + cls, imdb_id: str, overwrite: bool = False + ) -> "Video": video, created = cls.objects.get_or_create(imdb_id=imdb_id) if not created and not overwrite: return video @@ -405,7 +413,9 @@ class Video(ScrobblableMixin): return video @classmethod - def find_or_create(cls, source_id: str, overwrite: bool = True) -> "Video": + def find_or_create( + cls, source_id: str, overwrite: bool = False + ) -> "Video": if "tt" in source_id: return cls.get_from_imdb_id(source_id, overwrite) if bool(YOUTUBE_ID_PATTERN.match(source_id)):