From 6a282708f8f0993473894e35673adbc95136c09f Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Wed, 2 Feb 2022 23:15:29 -0500 Subject: [PATCH] fix season00 assets --- VERSION | 2 +- modules/plex.py | 41 ++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/VERSION b/VERSION index 860977cb..bf90bdde 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.15.1-develop37 +1.15.1-develop38 diff --git a/modules/plex.py b/modules/plex.py index 537f5fd8..ca6ffded 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -914,27 +914,26 @@ class Plex(Library): 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}" - if item_dir: - season_poster_filter = os.path.join(item_dir, f"{season_name}.*") - season_background_filter = os.path.join(item_dir, f"{season_name}_background.*") - else: - season_poster_filter = os.path.join(ad, f"{name}_{season_name}.*") - season_background_filter = os.path.join(ad, f"{name}_{season_name}_background.*") - season_poster = None - season_background = None - 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 self.show_missing_season_assets and season.seasonNumber > 0: - 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) - if season_poster or season_background: - self.upload_images(season, poster=season_poster, background=season_background) + season_name = f"Season{'0' if season.seasonNumber < 10 else ''}{season.seasonNumber}" + if item_dir: + season_poster_filter = os.path.join(item_dir, f"{season_name}.*") + season_background_filter = os.path.join(item_dir, f"{season_name}_background.*") + else: + season_poster_filter = os.path.join(ad, f"{name}_{season_name}.*") + season_background_filter = os.path.join(ad, f"{name}_{season_name}_background.*") + season_poster = None + season_background = None + 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 self.show_missing_season_assets and season.seasonNumber > 0: + 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) + if season_poster or season_background: + self.upload_images(season, poster=season_poster, background=season_background) for episode in self.query(season.episodes): if episode.seasonEpisode: if item_dir: