#247 added HDR to smart_filter

pull/264/head
meisnate12 4 years ago
parent 5a8c691ce4
commit 538a90dd1c

@ -492,7 +492,7 @@ class CollectionBuilder:
for smart_key, smart_data in filter_dict.items(): for smart_key, smart_data in filter_dict.items():
smart, smart_mod, smart_final = _split(smart_key) smart, smart_mod, smart_final = _split(smart_key)
def build_url_arg(arg, mod=None, arg_s=None, mod_s=None): def build_url_arg(arg, mod=None, arg_s=None, mod_s=None, param_s=None):
arg_key = plex.search_translation[smart] if smart in plex.search_translation else smart arg_key = plex.search_translation[smart] if smart in plex.search_translation else smart
if mod is None: if mod is None:
mod = plex.modifier_translation[smart_mod] if smart_mod in plex.search_translation else smart_mod mod = plex.modifier_translation[smart_mod] if smart_mod in plex.search_translation else smart_mod
@ -502,7 +502,9 @@ class CollectionBuilder:
mod_s = "does not contain" if smart_mod == ".not" else "contains" mod_s = "does not contain" if smart_mod == ".not" else "contains"
elif mod_s is None: elif mod_s is None:
mod_s = plex.mod_displays[smart_mod] mod_s = plex.mod_displays[smart_mod]
display_line = f"{indent}{smart.title().replace('_', ' ')} {mod_s} {arg_s}" if param_s is None:
param_s = smart.title().replace('_', ' ')
display_line = f"{indent}{param_s} {mod_s} {arg_s}"
return f"{arg_key}{mod}={arg}&", display_line return f"{arg_key}{mod}={arg}&", display_line
if smart_final in plex.movie_only_smart_searches and self.library.is_show: if smart_final in plex.movie_only_smart_searches and self.library.is_show:
@ -538,6 +540,13 @@ class CollectionBuilder:
results, display_add = build_url_arg(util.check_number(smart_data, smart_final, minimum=1)) results, display_add = build_url_arg(util.check_number(smart_data, smart_final, minimum=1))
elif smart in ["user_rating", "episode_user_rating", "critic_rating", "audience_rating"] and smart_mod in [".gt", ".gte", ".lt", ".lte"]: elif smart in ["user_rating", "episode_user_rating", "critic_rating", "audience_rating"] and smart_mod in [".gt", ".gte", ".lt", ".lte"]:
results, display_add = build_url_arg(util.check_number(smart_data, smart_final, number_type="float", minimum=0, maximum=10)) results, display_add = build_url_arg(util.check_number(smart_data, smart_final, number_type="float", minimum=0, maximum=10))
elif smart == "hdr":
if isinstance(smart_data, bool):
hdr_mod = "" if smart_data else "!"
hdr_arg = "true" if smart_data else "false"
results, display_add = build_url_arg(1, mod=hdr_mod, arg_s=hdr_arg, mod_s="is", param_s="HDR")
else:
raise Failed("Collection Error: HDR must be true or false")
else: else:
if smart in ["title", "episode_title"] and smart_mod in ["", ".not", ".begins", ".ends"]: if smart in ["title", "episode_title"] and smart_mod in ["", ".not", ".begins", ".ends"]:
results_list = [(t, t) for t in util.get_list(smart_data, split=False)] results_list = [(t, t) for t in util.get_list(smart_data, split=False)]

@ -182,7 +182,7 @@ smart_searches = [
"producer", "producer.not", "producer", "producer.not",
"subtitle_language", "subtitle_language.not", "subtitle_language", "subtitle_language.not",
"writer", "writer.not", "writer", "writer.not",
"decade", "resolution", "decade", "resolution", "hdr",
"added", "added.not", "added.before", "added.after", "added", "added.not", "added.before", "added.after",
"originally_available", "originally_available.not", "originally_available", "originally_available.not",
"originally_available.before", "originally_available.after", "originally_available.before", "originally_available.after",

Loading…
Cancel
Save