fix plex search

pull/351/head
meisnate12 3 years ago
parent 1f5b7b5818
commit 39dc94cca2

@ -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:

@ -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):

Loading…
Cancel
Save