[videos] Fix bad imdb_link format
This commit is contained in:
@ -27,7 +27,7 @@ from vrobbler.apps.scrobbles.dataclasses import BaseLogData, WithPeopleLogData
|
|||||||
|
|
||||||
YOUTUBE_VIDEO_URL = "https://www.youtube.com/watch?v="
|
YOUTUBE_VIDEO_URL = "https://www.youtube.com/watch?v="
|
||||||
YOUTUBE_CHANNEL_URL = "https://www.youtube.com/channel/"
|
YOUTUBE_CHANNEL_URL = "https://www.youtube.com/channel/"
|
||||||
YOUTUBE_ID_PATTERN = re.compile(r'^[A-Za-z0-9_-]{11}$')
|
YOUTUBE_ID_PATTERN = re.compile(r"^[A-Za-z0-9_-]{11}$")
|
||||||
IMDB_VIDEO_URL = "https://www.imdb.com/title/"
|
IMDB_VIDEO_URL = "https://www.imdb.com/title/"
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -218,7 +218,6 @@ class Series(TimeStampedModel):
|
|||||||
return series
|
return series
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Video(ScrobblableMixin):
|
class Video(ScrobblableMixin):
|
||||||
COMPLETION_PERCENT = getattr(settings, "VIDEO_COMPLETION_PERCENT", 90)
|
COMPLETION_PERCENT = getattr(settings, "VIDEO_COMPLETION_PERCENT", 90)
|
||||||
SECONDS_TO_STALE = getattr(settings, "VIDEO_SECONDS_TO_STALE", 14400)
|
SECONDS_TO_STALE = getattr(settings, "VIDEO_SECONDS_TO_STALE", 14400)
|
||||||
@ -296,7 +295,10 @@ class Video(ScrobblableMixin):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def imdb_link(self):
|
def imdb_link(self):
|
||||||
return f"https://www.imdb.com/title/tt{self.imdb_id}"
|
prefix = ""
|
||||||
|
if "tt" not in self.imdb_id:
|
||||||
|
prefix = "tt"
|
||||||
|
return f"https://www.imdb.com/title/{prefix}{self.imdb_id}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def info_link(self):
|
def info_link(self):
|
||||||
@ -369,7 +371,9 @@ class Video(ScrobblableMixin):
|
|||||||
setattr(video, k, v)
|
setattr(video, k, v)
|
||||||
|
|
||||||
if series_id:
|
if series_id:
|
||||||
video.tv_series = Series.find_or_create(imdb_id=series_id, overwrite=overwrite)
|
video.tv_series = Series.find_or_create(
|
||||||
|
imdb_id=series_id, overwrite=overwrite
|
||||||
|
)
|
||||||
|
|
||||||
video.save()
|
video.save()
|
||||||
|
|
||||||
@ -387,7 +391,7 @@ class Video(ScrobblableMixin):
|
|||||||
if bool(YOUTUBE_ID_PATTERN.match(source_id)):
|
if bool(YOUTUBE_ID_PATTERN.match(source_id)):
|
||||||
return cls.get_from_youtube_id(source_id, overwrite)
|
return cls.get_from_youtube_id(source_id, overwrite)
|
||||||
|
|
||||||
#TODO scrobble but without a video obj?
|
# TODO scrobble but without a video obj?
|
||||||
logger.warning("Video ID not recognized, not scrobbling")
|
logger.warning("Video ID not recognized, not scrobbling")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user