From 39dc94cca2beddb6846cd4f552afaf9dea454691 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 26 Jul 2021 14:52:32 -0400 Subject: [PATCH] fix plex search --- modules/builder.py | 1 + modules/plex.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index e07274a1..f54381ef 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1070,6 +1070,7 @@ class CollectionBuilder: def build_url_arg(arg, mod=None, arg_s=None, mod_s=None): arg_key = plex.search_translation[attr] if attr in plex.search_translation else attr + arg_key = plex.show_translation[arg_key] if self.library.is_show and arg_key in plex.show_translation else arg_key if mod is None: mod = plex.modifier_translation[modifier] if modifier in plex.modifier_translation else modifier if arg_s is None: diff --git a/modules/plex.py b/modules/plex.py index ac1d6d99..1bca19b2 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -33,6 +33,12 @@ search_translation = { "episode_user_rating": "episode.userRating", "episode_plays": "episode.viewCount" } +show_translation = { + "hdr": "episode.hdr", + "audioLanguage": "episode.audioLanguage", + "subtitleLanguage": "episode.subtitleLanguage", + "resolution": "episode.resolution" +} modifier_translation = { "": "", ".not": "!", ".gt": "%3E%3E", ".gte": "%3E", ".lt": "%3C%3C", ".lte": "%3C", ".before": "%3C%3C", ".after": "%3E%3E", ".begins": "%3C", ".ends": "%3E" @@ -455,8 +461,7 @@ class Plex: @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed) def get_search_choices(self, search_name, title=True): final_search = search_translation[search_name] if search_name in search_translation else search_name - if final_search == "resolution" and self.is_show: - final_search = "episode.resolution" + final_search = show_translation[final_search] if self.is_show and final_search in show_translation else final_search try: choices = {} for choice in self.Plex.listFilterChoices(final_search): @@ -464,7 +469,8 @@ class Plex: choices[choice.key.lower()] = choice.title if title else choice.key return choices except NotFound: - raise Failed(f"Collection Error: plex search attribute: {search_name} only supported with Plex's New TV Agent") + logger.debug(f"Search Attribute: {final_search}") + raise Failed(f"Collection Error: plex search attribute: {search_name} not supported") @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex) def get_labels(self):