From f617920a4ffeb347da219dc0e1ac292a32fa0f5f Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 25 Jan 2022 01:54:44 -0500 Subject: [PATCH] #594 adds show_missing_season_assets setting --- modules/config.py | 2 ++ modules/library.py | 1 + modules/plex.py | 14 +++++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/config.py b/modules/config.py index ab3978ad..484c83f7 100644 --- a/modules/config.py +++ b/modules/config.py @@ -269,6 +269,7 @@ class ConfigFile: "dimensional_asset_rename": check_for_attribute(self.data, "dimensional_asset_rename", parent="settings", var_type="bool", default=False), "download_url_assets": check_for_attribute(self.data, "download_url_assets", parent="settings", var_type="bool", default=False), "show_missing_season_assets": check_for_attribute(self.data, "show_missing_season_assets", parent="settings", var_type="bool", default=False), + "show_missing_episode_assets": check_for_attribute(self.data, "show_missing_episode_assets", parent="settings", var_type="bool", default=False), "sync_mode": check_for_attribute(self.data, "sync_mode", parent="settings", default="append", test_list=sync_modes), "default_collection_order": check_for_attribute(self.data, "default_collection_order", parent="settings", default_is_none=True), "minimum_items": check_for_attribute(self.data, "minimum_items", parent="settings", var_type="int", default=1), @@ -584,6 +585,7 @@ class ConfigFile: params["dimensional_asset_rename"] = check_for_attribute(lib, "dimensional_asset_rename", parent="settings", var_type="bool", default=self.general["dimensional_asset_rename"], do_print=False, save=False) params["download_url_assets"] = check_for_attribute(lib, "download_url_assets", parent="settings", var_type="bool", default=self.general["download_url_assets"], do_print=False, save=False) params["show_missing_season_assets"] = check_for_attribute(lib, "show_missing_season_assets", parent="settings", var_type="bool", default=self.general["show_missing_season_assets"], do_print=False, save=False) + params["show_missing_episode_assets"] = check_for_attribute(lib, "show_missing_episode_assets", parent="settings", var_type="bool", default=self.general["show_missing_episode_assets"], do_print=False, save=False) params["minimum_items"] = check_for_attribute(lib, "minimum_items", parent="settings", var_type="int", default=self.general["minimum_items"], do_print=False, save=False) params["item_refresh_delay"] = check_for_attribute(lib, "item_refresh_delay", parent="settings", var_type="int", default=self.general["item_refresh_delay"], do_print=False, save=False) params["delete_below_minimum"] = check_for_attribute(lib, "delete_below_minimum", parent="settings", var_type="bool", default=self.general["delete_below_minimum"], do_print=False, save=False) diff --git a/modules/library.py b/modules/library.py index 79f28be1..f8114f67 100644 --- a/modules/library.py +++ b/modules/library.py @@ -46,6 +46,7 @@ class Library(ABC): self.dimensional_asset_rename = params["dimensional_asset_rename"] self.download_url_assets = params["download_url_assets"] self.show_missing_season_assets = params["show_missing_season_assets"] + self.show_missing_episode_assets = params["show_missing_episode_assets"] self.sync_mode = params["sync_mode"] self.default_collection_order = params["default_collection_order"] self.minimum_items = params["minimum_items"] diff --git a/modules/plex.py b/modules/plex.py index 92c5fce2..cdd90499 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -904,7 +904,7 @@ class Plex(Library): return poster, background, item_dir if isinstance(item, Show): missing_assets = "" - found_season = False + found_image = False for season in self.query(item.seasons): season_name = f"Season{'0' if season.seasonNumber < 10 else ''}{season.seasonNumber}" if item_dir: @@ -918,8 +918,8 @@ class Plex(Library): matches = util.glob_filter(season_poster_filter) if len(matches) > 0: season_poster = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title} Season {season.seasonNumber}'s ", is_url=False) - found_season = True - elif season.seasonNumber > 0: + found_image = True + elif self.show_missing_season_assets and season.seasonNumber > 0: missing_assets += f"\nMissing Season {season.seasonNumber} Poster" matches = util.glob_filter(season_background_filter) if len(matches) > 0: @@ -934,9 +934,13 @@ class Plex(Library): matches = util.glob_filter(episode_filter) if len(matches) > 0: episode_poster = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title} {episode.seasonEpisode.upper()}'s ", is_url=False) + found_image = True self.upload_images(episode, poster=episode_poster) - if self.show_missing_season_assets and found_season and missing_assets: - util.print_multiline(f"Missing Season Posters for {item.title}{missing_assets}", info=True) + elif self.show_missing_episode_assets: + missing_assets += f"\nMissing {episode.seasonEpisode.upper()} Title Card" + + if found_image and missing_assets: + util.print_multiline(f"Missing Posters for {item.title}{missing_assets}", info=True) if isinstance(item, Artist): missing_assets = "" found_album = False