From c7c47bf5c541e7f9ea429136c9b02393e30a894c Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Wed, 26 Jan 2022 16:24:36 -0500 Subject: [PATCH] #658 show_missing_episode_assets fix --- modules/plex.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/plex.py b/modules/plex.py index a983d2d5..9348520a 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -903,8 +903,10 @@ class Plex(Library): else: return poster, background, item_dir if isinstance(item, Show): - missing_assets = "" - found_image = False + missing_seasons = "" + missing_episodes = "" + found_season = False + found_episode = False for season in self.query(item.seasons): if season.seasonNumber: season_name = f"Season{'0' if season.seasonNumber < 10 else ''}{season.seasonNumber}" @@ -919,9 +921,9 @@ 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_image = True + found_season = True elif self.show_missing_season_assets and season.seasonNumber > 0: - missing_assets += f"\nMissing Season {season.seasonNumber} Poster" + missing_seasons += f"\nMissing Season {season.seasonNumber} Poster" matches = util.glob_filter(season_background_filter) if len(matches) > 0: season_background = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title} Season {season.seasonNumber}'s ", is_poster=False, is_url=False) @@ -936,13 +938,18 @@ 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 + found_episode = True self.upload_images(episode, poster=episode_poster) 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) + missing_episodes += f"\nMissing {episode.seasonEpisode.upper()} Title Card" + + if (found_season and missing_seasons) or (found_episode and missing_episodes): + output = f"Missing Posters for {item.title}" + if found_season: + output += missing_seasons + if found_episode: + output += missing_episodes + util.print_multiline(output, info=True) if isinstance(item, Artist): missing_assets = "" found_album = False