Reorder overlays to episodes > seasons > shows.

This commit is contained in:
Yozora 2024-08-29 14:29:53 +01:00 committed by meisnate12
parent 4cea31bee6
commit 4f2a3f9078
3 changed files with 9 additions and 6 deletions

View file

@ -12,6 +12,7 @@ Fixes an issue where Prime Video overlays/collections would not be built when th
# Bug Fixes # Bug Fixes
Fixed the `cast` search option for the `imdb_search` builder Fixed the `cast` search option for the `imdb_search` builder
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.
Fixes #2258 `imdb_list` sort was not being parsed correctly Fixes #2258 `imdb_list` sort was not being parsed correctly
Fixes `letterboxd_list` rating filter to use a 1-10 rating vs 1-100 to reflect how letterboxd ratings work on their website Fixes `letterboxd_list` rating filter to use a 1-10 rating vs 1-100 to reflect how letterboxd ratings work on their website
Fixed the `ids_to_anidb` lookup for anime movies and shows Fixed the `ids_to_anidb` lookup for anime movies and shows

View file

@ -82,7 +82,7 @@ class Overlays:
raise Failed raise Failed
return _trakt_ratings 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") item_title = self.library.get_item_sort_title(item, atr="title")
try: try:
logger.ghost(f"Overlaying: {i}/{len(key_to_overlays)} {item_title}") logger.ghost(f"Overlaying: {i}/{len(key_to_overlays)} {item_title}")

View file

@ -1640,15 +1640,17 @@ class Plex(Library):
return map_key, attrs 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): 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): 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): 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: else:
return getattr(item_to_sort, atr) return f"{getattr(item_to_sort, atr)}{'2' if ep_first_order else ''}"
def split(self, text): def split(self, text):
attribute, modifier = os.path.splitext(str(text).lower()) attribute, modifier = os.path.splitext(str(text).lower())