#658 show_missing_episode_assets fix

This commit is contained in:
meisnate12 2022-01-26 16:24:36 -05:00
parent 07d53f5fdb
commit c7c47bf5c5

View file

@ -903,8 +903,10 @@ class Plex(Library):
else: else:
return poster, background, item_dir return poster, background, item_dir
if isinstance(item, Show): if isinstance(item, Show):
missing_assets = "" missing_seasons = ""
found_image = False missing_episodes = ""
found_season = False
found_episode = False
for season in self.query(item.seasons): for season in self.query(item.seasons):
if season.seasonNumber: if season.seasonNumber:
season_name = f"Season{'0' if season.seasonNumber < 10 else ''}{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) matches = util.glob_filter(season_poster_filter)
if len(matches) > 0: 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) 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: 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) matches = util.glob_filter(season_background_filter)
if len(matches) > 0: 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) 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) matches = util.glob_filter(episode_filter)
if len(matches) > 0: 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) 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) self.upload_images(episode, poster=episode_poster)
elif self.show_missing_episode_assets: elif self.show_missing_episode_assets:
missing_assets += f"\nMissing {episode.seasonEpisode.upper()} Title Card" missing_episodes += f"\nMissing {episode.seasonEpisode.upper()} Title Card"
if found_image and missing_assets: if (found_season and missing_seasons) or (found_episode and missing_episodes):
util.print_multiline(f"Missing Posters for {item.title}{missing_assets}", info=True) 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): if isinstance(item, Artist):
missing_assets = "" missing_assets = ""
found_album = False found_album = False