Fix a bug in IMDB lookups for episodes
This commit is contained in:
@ -22,14 +22,14 @@ def lookup_video_from_imdb(imdb_id: str) -> dict:
|
|||||||
run_time_seconds = 60 * 60
|
run_time_seconds = 60 * 60
|
||||||
runtimes = media.get("runtimes")
|
runtimes = media.get("runtimes")
|
||||||
if runtimes:
|
if runtimes:
|
||||||
run_time_seconds = int(runtimes)[0] * 60
|
run_time_seconds = int(runtimes[0]) * 60
|
||||||
|
|
||||||
# Ticks otherwise known as miliseconds
|
# Ticks otherwise known as miliseconds
|
||||||
run_time_ticks = run_time_seconds * 1000 * 1000
|
run_time_ticks = run_time_seconds * 1000 * 1000
|
||||||
|
|
||||||
item_type = Video.VideoType.MOVIE
|
item_type = "Movie"
|
||||||
if media.get('series title'):
|
if media.get('series title'):
|
||||||
item_type = Video.VideoType.TV_EPISODE
|
item_type = "Episode"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
plot = media.get('plot')[0]
|
plot = media.get('plot')[0]
|
||||||
@ -38,6 +38,7 @@ def lookup_video_from_imdb(imdb_id: str) -> dict:
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
plot = ""
|
plot = ""
|
||||||
|
|
||||||
|
logger.debug(f"Received data from IMDB: {media.__dict__}")
|
||||||
# Build a rough approximation of a Jellyfin data response
|
# Build a rough approximation of a Jellyfin data response
|
||||||
data_dict = {
|
data_dict = {
|
||||||
"ItemType": item_type,
|
"ItemType": item_type,
|
||||||
@ -57,5 +58,6 @@ def lookup_video_from_imdb(imdb_id: str) -> dict:
|
|||||||
"IsPaused": False,
|
"IsPaused": False,
|
||||||
"PlayedToCompletion": False,
|
"PlayedToCompletion": False,
|
||||||
}
|
}
|
||||||
|
logger.debug(f"Parsed data from IMDB data: {data_dict}")
|
||||||
|
|
||||||
return data_dict
|
return data_dict
|
||||||
|
|||||||
@ -49,8 +49,9 @@ class RecentScrobbleList(ListView):
|
|||||||
user = self.request.user
|
user = self.request.user
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if self.request.user.is_authenticated:
|
if self.request.user.is_authenticated:
|
||||||
timezone.activate(pytz.timezone(user.profile.timezone))
|
if user.profile:
|
||||||
now = timezone.localtime(timezone.now())
|
timezone.activate(pytz.timezone(user.profile.timezone))
|
||||||
|
now = timezone.localtime(timezone.now())
|
||||||
data['now_playing_list'] = Scrobble.objects.filter(
|
data['now_playing_list'] = Scrobble.objects.filter(
|
||||||
in_progress=True,
|
in_progress=True,
|
||||||
is_paused=False,
|
is_paused=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user