[97] allow shows to pull seasons and episodes for lower level collections

This commit is contained in:
meisnate12 2022-10-06 15:50:37 -04:00
parent 2589e764ca
commit b5dc7b3582
4 changed files with 27 additions and 7 deletions

View file

@ -1 +1 @@
1.17.3-develop96 1.17.3-develop97

View file

@ -33,6 +33,7 @@ templates:
- use_<<key>> - use_<<key>>
- time_window_<<key>> - time_window_<<key>>
- location_<<key>> - location_<<key>>
- overlay_level
default: default:
style: round style: round
overlay: <<overlay_name>> overlay: <<overlay_name>>
@ -59,6 +60,7 @@ templates:
limit: 10 limit: 10
limit_<<key>>: <<limit>> limit_<<key>>: <<limit>>
weight_<<key>>: <<weight>> weight_<<key>>: <<weight>>
overlay_level: <<overlay_level>>
ignore_blank_results: true ignore_blank_results: true
allowed_library_types: <<use_<<key>>>> allowed_library_types: <<use_<<key>>>>
overlay: overlay:

View file

@ -61,6 +61,7 @@ templates:
back_radius: 30 back_radius: 30
back_width: 305 back_width: 305
back_height: 105 back_height: 105
overlay_level: <<overlay_level>>
allowed_library_types: <<use_<<slug>>>> allowed_library_types: <<use_<<slug>>>>
ignore_blank_results: true ignore_blank_results: true
overlay: overlay:

View file

@ -1692,7 +1692,8 @@ class CollectionBuilder:
self.missing_parts.append(f"{show_item.title} Season: {season_num} Episode: {episode_num} Missing") self.missing_parts.append(f"{show_item.title} Season: {season_num} Episode: {episode_num} Missing")
if not found and tvdb_id not in self.missing_shows and self.do_missing: if not found and tvdb_id not in self.missing_shows and self.do_missing:
self.missing_shows.append(tvdb_id) self.missing_shows.append(tvdb_id)
elif id_type in ["tvdb", "tmdb_show", "tvdb_season", "tvdb_episode"] and not self.parts_collection: elif id_type in ["tvdb", "tmdb_show", "tvdb_season", "tvdb_episode"]:
tvdb_season = None
if id_type == "tmdb_show": if id_type == "tmdb_show":
try: try:
tvdb_id = self.config.Convert.tmdb_to_tvdb(input_id, fail=True) tvdb_id = self.config.Convert.tmdb_to_tvdb(input_id, fail=True)
@ -1700,22 +1701,38 @@ class CollectionBuilder:
logger.warning(e) logger.warning(e)
continue continue
elif id_type == "tvdb_season": elif id_type == "tvdb_season":
tvdb_id, _ = input_id.split("_") tvdb_id, tvdb_season = input_id.split("_")
tvdb_id = int(tvdb_id) tvdb_id = int(tvdb_id)
tvdb_season = int(tvdb_season)
elif id_type == "tvdb_episode": elif id_type == "tvdb_episode":
tvdb_id, _, _ = input_id.split("_") tvdb_id, _, _ = input_id.split("_")
tvdb_id = int(tvdb_id) tvdb_id = int(tvdb_id)
else: else:
tvdb_id = int(input_id) tvdb_id = int(input_id)
if tvdb_id not in self.ignore_ids: if tvdb_id not in self.ignore_ids:
found = False found_keys = None
for pl_library in self.libraries: for pl_library in self.libraries:
if tvdb_id in pl_library.show_map: if tvdb_id in pl_library.show_map:
found = True found_keys = pl_library.show_map[tvdb_id]
rating_keys = pl_library.show_map[tvdb_id]
break break
if not found and tvdb_id not in self.missing_shows: if not found_keys and tvdb_id not in self.missing_shows:
self.missing_shows.append(tvdb_id) self.missing_shows.append(tvdb_id)
if found_keys:
if self.parts_collection:
rating_keys = []
for rk in found_keys:
try:
item = self.fetch_item(rk)
if self.builder_level == "episode" and isinstance(item, Show):
if tvdb_season is not None:
item = item.season(season=tvdb_season)
rating_keys.extend([k.ratingKey for k in item.episodes()])
elif self.builder_level == "season" and isinstance(item, Show):
rating_keys.extend([k.ratingKey for k in item.seasons()])
except Failed as e:
logger.error(e)
else:
rating_keys = found_keys
else: else:
continue continue