mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fix special season handling
This commit is contained in:
parent
70afa7cc9b
commit
a1a5e665fb
@ -334,10 +334,11 @@ class TheMovieDatabase(Provider):
|
|||||||
await self.get_absolute_order(show_id)
|
await self.get_absolute_order(show_id)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
absolute
|
absolute is not None
|
||||||
and (not season or not episode_nbr)
|
and (season is None or episode_nbr is None)
|
||||||
and self.absolute_episode_cache[show_id]
|
and show_id in self.absolute_episode_cache
|
||||||
and self.absolute_episode_cache[show_id][absolute]
|
and self.absolute_episode_cache[show_id] is not None
|
||||||
|
and absolute in self.absolute_episode_cache[show_id]
|
||||||
):
|
):
|
||||||
# Using absolute - 1 since the array is 0based (absolute episode 1 is at index 0)
|
# Using absolute - 1 since the array is 0based (absolute episode 1 is at index 0)
|
||||||
season = self.absolute_episode_cache[show_id][absolute - 1]["season_number"]
|
season = self.absolute_episode_cache[show_id][absolute - 1]["season_number"]
|
||||||
@ -345,12 +346,12 @@ class TheMovieDatabase(Provider):
|
|||||||
"episode_number"
|
"episode_number"
|
||||||
]
|
]
|
||||||
|
|
||||||
if not season or not episode_nbr:
|
if season is None or episode_nbr is None:
|
||||||
# Some shows don't have absolute numbering because the default one is absolute on tmdb (for example detetive conan)
|
# Some shows don't have absolute numbering because the default one is absolute on tmdb (for example detetive conan)
|
||||||
season = 1
|
season = 1
|
||||||
episode_nbr = absolute
|
episode_nbr = absolute
|
||||||
|
|
||||||
if not absolute and self.absolute_episode_cache[show_id]:
|
if absolute is None and self.absolute_episode_cache[show_id]:
|
||||||
absolute = next(
|
absolute = next(
|
||||||
(
|
(
|
||||||
# The + 1 is to go from 0based index to 1based absolute number
|
# The + 1 is to go from 0based index to 1based absolute number
|
||||||
@ -457,7 +458,8 @@ class TheMovieDatabase(Provider):
|
|||||||
self.absolute_episode_cache[show_id] = None
|
self.absolute_episode_cache[show_id] = None
|
||||||
return
|
return
|
||||||
group = await self.get(f"tv/episode_group/{group_id}")
|
group = await self.get(f"tv/episode_group/{group_id}")
|
||||||
self.absolute_episode_cache[show_id] = group["groups"][0]["episodes"]
|
grp = next(group["groups"], None)
|
||||||
|
self.absolute_episode_cache[show_id] = grp["episodes"] if grp else None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(
|
logging.exception(
|
||||||
"Could not retrieve absolute ordering information", exc_info=e
|
"Could not retrieve absolute ordering information", exc_info=e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user