Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tmdb absolute with long running animes (one-piece, naruto...) #326

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions scanner/providers/implementations/themoviedatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,21 @@ async def identify_episode(
absolute = await self.get_absolute_number(show_id, season, episode_nbr)

async def for_language(lng: str) -> Episode:
episode = await self.get(
f"tv/{show_id}/season/{season}/episode/{episode_nbr}",
params={
"language": lng,
},
not_found_fail=f"Could not find episode {episode_nbr} of season {season} of serie {name}",
)
try:
episode = await self.get(
f"tv/{show_id}/season/{season}/episode/{episode_nbr}",
params={
"language": lng,
},
)
except:
episode = await self.get(
f"tv/{show_id}/season/{season}/episode/{absolute}",
params={
"language": lng,
},
not_found_fail=f"Could not find episode {episode_nbr} of season {season} of serie {name} (absolute: {absolute})",
)
logging.debug("TMDb responded: %s", episode)

ret = Episode(
Expand Down
2 changes: 1 addition & 1 deletion scanner/providers/implementations/thexem.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def get_show_map(
ret = await r.json()
if "data" not in ret or ret["result"] == "failure":
logging.error("Could not fetch xem mapping. Error: %s", ret["message"])
raise ProviderError("Could not fetch xem mapping")
return []
return ret["data"]

async def get_show_override(
Expand Down
4 changes: 1 addition & 3 deletions scanner/providers/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ async def identify_show(self, show_id: str) -> Show:
raise NotImplementedError

@abstractmethod
async def identify_season(
self, show_id: str, season_number: Optional[int]
) -> Season:
async def identify_season(self, show_id: str, season_number: int) -> Season:
raise NotImplementedError

@abstractmethod
Expand Down
Loading