mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-26 06:20:23 +00:00
fix blank plex filters
This commit is contained in:
parent
17ec7f150c
commit
d0b50a83a2
1 changed files with 48 additions and 39 deletions
|
@ -1504,25 +1504,28 @@ class CollectionBuilder:
|
|||
display_line = f"{indent}{param_s} {mod_s} {arg_s}"
|
||||
return f"{arg_key}{mod}={arg}&", display_line
|
||||
|
||||
error = None
|
||||
if final_attr not in plex.searches and not final_attr.startswith(("any", "all")):
|
||||
raise Failed(f"{self.Type} Error: {final_attr} is not a valid {method} attribute")
|
||||
error = f"{self.Type} Error: {final_attr} is not a valid {method} attribute"
|
||||
elif self.library.is_show and final_attr in plex.movie_only_searches:
|
||||
raise Failed(f"{self.Type} Error: {final_attr} {method} attribute only works for movie libraries")
|
||||
error = f"{self.Type} Error: {final_attr} {method} attribute only works for movie libraries"
|
||||
elif self.library.is_movie and final_attr in plex.show_only_searches:
|
||||
raise Failed(f"{self.Type} Error: {final_attr} {method} attribute only works for show libraries")
|
||||
error = f"{self.Type} Error: {final_attr} {method} attribute only works for show libraries"
|
||||
elif self.library.is_music and final_attr not in plex.music_searches:
|
||||
raise Failed(f"{self.Type} Error: {final_attr} {method} attribute does not work for music libraries")
|
||||
error = f"{self.Type} Error: {final_attr} {method} attribute does not work for music libraries"
|
||||
elif not self.library.is_music and final_attr in plex.music_searches:
|
||||
raise Failed(f"{self.Type} Error: {final_attr} {method} attribute only works for music libraries")
|
||||
elif _data is None:
|
||||
raise Failed(f"{self.Type} Error: {final_attr} {method} attribute is blank")
|
||||
elif final_attr.startswith(("any", "all")):
|
||||
error = f"{self.Type} Error: {final_attr} {method} attribute only works for music libraries"
|
||||
elif not _data:
|
||||
error = f"{self.Type} Error: {final_attr} {method} attribute is blank"
|
||||
else:
|
||||
if final_attr.startswith(("any", "all")):
|
||||
dicts = util.get_list(_data)
|
||||
results = ""
|
||||
display_add = ""
|
||||
for dict_data in dicts:
|
||||
if not isinstance(dict_data, dict):
|
||||
raise Failed(f"{self.Type} Error: {attr} must be either a dictionary or list of dictionaries")
|
||||
raise Failed(
|
||||
f"{self.Type} Error: {attr} must be either a dictionary or list of dictionaries")
|
||||
inside_filter, inside_display = _filter(dict_data, is_all=attr == "all", level=level)
|
||||
if len(inside_filter) > 0:
|
||||
display_add += inside_display
|
||||
|
@ -1552,6 +1555,12 @@ class CollectionBuilder:
|
|||
results, display_add = build_url_arg(validation)
|
||||
display += display_add
|
||||
output += f"{conjunction if len(output) > 0 else ''}{results}"
|
||||
if error:
|
||||
if validate:
|
||||
raise Failed(error)
|
||||
else:
|
||||
logger.error(error)
|
||||
continue
|
||||
return output, display
|
||||
|
||||
if "any" not in filter_alias and "all" not in filter_alias:
|
||||
|
|
Loading…
Reference in a new issue