pull/211/head
meisnate12 4 years ago
parent bb9979c1ae
commit b98bb768b2

@ -203,16 +203,19 @@ class PlexAPI:
item.addCollection(name) item.addCollection(name)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed) @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
def get_search_choices(self, search_name, key=False): def get_search_choices(self, search_name):
try: try:
if key: return {c.key.lower(): c.key for c in self.Plex.listFilterChoices(search_name)} choices = {}
else: return {c.title.lower(): c.title for c in self.Plex.listFilterChoices(search_name)} for choice in self.Plex.listFilterChoices(search_name):
choices[choice.title.lower()] = choice.title
choices[choice.key.lower()] = choice.title
return choices
except NotFound: except NotFound:
raise Failed(f"Collection Error: plex search attribute: {search_name} only supported with Plex's New TV Agent") raise Failed(f"Collection Error: plex search attribute: {search_name} only supported with Plex's New TV Agent")
def validate_search_list(self, data, search_name): def validate_search_list(self, data, search_name):
final_search = search_translation[search_name] if search_name in search_translation else search_name final_search = search_translation[search_name] if search_name in search_translation else search_name
search_choices = self.get_search_choices(final_search, key=final_search.endswith("Language")) search_choices = self.get_search_choices(final_search)
valid_list = [] valid_list = []
for value in util.get_list(data): for value in util.get_list(data):
if str(value).lower() in search_choices: if str(value).lower() in search_choices:

@ -89,7 +89,7 @@ util.centered("| |_) | |/ _ \\ \\/ / | |\\/| |/ _ \\ __/ _` | | |\\/| |/ _` | '_
util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ") util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ")
util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ") util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ")
util.centered(" |___/ ") util.centered(" |___/ ")
util.centered(" Version: 1.7.2-Beta2 ") util.centered(" Version: 1.7.2-Beta3 ")
util.separator() util.separator()
if my_tests: if my_tests:

Loading…
Cancel
Save