From 4442b1c157ac835d910f292ca529480d1187eb0c Mon Sep 17 00:00:00 2001 From: Yozora Date: Thu, 29 Aug 2024 14:29:53 +0100 Subject: [PATCH] Reorder overlays to episodes > seasons > shows. --- CHANGELOG | 1 + modules/overlays.py | 2 +- modules/plex.py | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e65981947..1e467e164 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,6 +22,7 @@ Added `A Quiet Place: Day One` to the `A Quiet Place` collection in the `franchi Add `minimum_items_<>` to universe Default file # Bug Fixes +Fixed an issue where season-level overlays would not work if the season had no image and the show-level image already had an overlay. As a result, episode overlays will now apply before season overlays, and season overlays will now apply before show overlays. Fixed multiple anime `int()` Errors Fixed #2100 `verify_ssl` wasn't working when downloading images Fixed an issue with `delete_collections` where items were being deleted if they only matched one criteria vs all criteria diff --git a/modules/overlays.py b/modules/overlays.py index b5bbb59d0..18758db9a 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -82,7 +82,7 @@ def trakt_ratings(): raise Failed return _trakt_ratings - for i, (over_key, (item, over_names)) in enumerate(sorted(key_to_overlays.items(), key=lambda io: self.library.get_item_sort_title(io[1][0])), 1): + for i, (over_key, (item, over_names)) in enumerate(sorted(key_to_overlays.items(), key=lambda io: self.library.get_item_sort_title(io[1][0], ep_first_order=True)), 1): item_title = self.library.get_item_sort_title(item, atr="title") try: logger.ghost(f"Overlaying: {i}/{len(key_to_overlays)} {item_title}") diff --git a/modules/plex.py b/modules/plex.py index d5e4a560d..3b0d45bdd 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -1640,15 +1640,17 @@ def _recur(sub, item_type_in=None): return map_key, attrs - def get_item_sort_title(self, item_to_sort, atr="titleSort"): + + def get_item_sort_title(self, item_to_sort, atr="titleSort", ep_first_order=False): if isinstance(item_to_sort, Album): - return f"{getattr(item_to_sort.artist(), atr)} Album {getattr(item_to_sort, atr)}" + return f"{getattr(item_to_sort.artist(), atr)}{'1' if ep_first_order else ''} Album {getattr(item_to_sort, atr)}" elif isinstance(item_to_sort, Season): - return f"{getattr(item_to_sort.show(), atr)} Season {item_to_sort.seasonNumber}" + return f"{getattr(item_to_sort.show(), atr)}{'1' if ep_first_order else ''} Season {item_to_sort.seasonNumber}" elif isinstance(item_to_sort, Episode): - return f"{getattr(item_to_sort.show(), atr)} {item_to_sort.seasonEpisode.upper()}" + return f"{getattr(item_to_sort.show(), atr)}{'0' if ep_first_order else ''} {item_to_sort.seasonEpisode.upper()}" else: - return getattr(item_to_sort, atr) + return f"{getattr(item_to_sort, atr)}{'2' if ep_first_order else ''}" + def split(self, text): attribute, modifier = os.path.splitext(str(text).lower())