scanner: supports tmdb episode groups with multiple groups (#447)

This commit is contained in:
Antoine 2024-04-28 20:31:30 +02:00 committed by GitHub
parent f431e7930d
commit 08bb1ccbf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -562,6 +562,8 @@ class TheMovieDatabase(Provider):
try: try:
groups = await self.get(f"tv/{show_id}/episode_groups") groups = await self.get(f"tv/{show_id}/episode_groups")
ep_count = max((x["episode_count"] for x in groups["results"]), default=0) ep_count = max((x["episode_count"] for x in groups["results"]), default=0)
if ep_count == 0:
return None
# Filter only absolute groups that contains at least 75% of all episodes (to skip non maintained absolute ordering) # Filter only absolute groups that contains at least 75% of all episodes (to skip non maintained absolute ordering)
group_id = next( group_id = next(
( (
@ -575,8 +577,7 @@ class TheMovieDatabase(Provider):
if group_id is None: if group_id is None:
return None return None
group = await self.get(f"tv/episode_group/{group_id}") group = await self.get(f"tv/episode_group/{group_id}")
grp = next(iter(group["groups"]), None) return [ep for grp in group["groups"] for ep in grp["episodes"]]
return grp["episodes"] if grp else None
except Exception as e: except Exception as e:
logger.exception( logger.exception(
"Could not retrieve absolute ordering information", exc_info=e "Could not retrieve absolute ordering information", exc_info=e