From 7da12bc33c0fb442a0516faf03f6d2c68f350f3d Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 26 Mar 2021 18:17:24 -0400 Subject: [PATCH] fixes #142 and other bugs --- modules/builder.py | 22 ++++++++++++---------- modules/config.py | 1 - modules/plex.py | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index 65c32d5f..c7eda519 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -85,6 +85,7 @@ class CollectionBuilder: optional.append(str(template["optional"])) else: raise Failed("Collection Error: template sub-attribute optional is blank") + for method_name, attr_data in template.items(): if method_name not in self.data and method_name not in ["default", "optional"]: if attr_data: @@ -108,30 +109,31 @@ class CollectionBuilder: except ValueError: return txt try: if isinstance(attr_data, dict): - discover_name = {} + final_data = {} for sm in attr_data: if isinstance(attr_data[sm], list): temp_list = [] for li in attr_data[sm]: temp_list.append(replace_txt(li)) - discover_name[sm] = temp_list + final_data[sm] = temp_list else: - discover_name[sm] = replace_txt(attr_data[sm]) + final_data[sm] = replace_txt(attr_data[sm]) elif isinstance(attr_data, list): - discover_name = [] + final_data = [] for li in attr_data: if isinstance(li, dict): temp_dict = {} for sm in li: temp_dict[sm] = replace_txt(li[sm]) - discover_name.append(temp_dict) + final_data.append(temp_dict) else: - discover_name.append(replace_txt(li)) + final_data.append(replace_txt(li)) else: - discover_name = replace_txt(attr_data) + final_data = replace_txt(attr_data) except Failed: continue - self.data[method_name] = discover_name + self.data[method_name] = final_data + methods[method_name.lower()] = method_name else: raise Failed(f"Collection Error: template attribute {method_name} is blank") @@ -509,7 +511,7 @@ class CollectionBuilder: self.methods.append((method_name, [searches])) elif method_name == "tmdb_discover": new_dictionary = {"limit": 100} - for discover_name, discover_data in method_data: + for discover_name, discover_data in method_data.items(): discover_final = discover_name.lower() if discover_data: if (self.library.is_movie and discover_final in util.discover_movie) or (self.library.is_show and discover_final in util.discover_tv): @@ -806,7 +808,7 @@ class CollectionBuilder: has_processed = False search_limit = None search_sort = None - for search_method, search_data in value: + for search_method, search_data in value.items(): if search_method == "limit": search_limit = search_data elif search_method == "sort_by": diff --git a/modules/config.py b/modules/config.py index 6789a253..8c4b5b91 100644 --- a/modules/config.py +++ b/modules/config.py @@ -428,7 +428,6 @@ class Config: try: builder = CollectionBuilder(self, library, mapping_name, collection_attrs) except Failed as ef: - util.print_stacktrace() util.print_multiline(ef, error=True) continue except Exception as ee: diff --git a/modules/plex.py b/modules/plex.py index df2011fd..c18944a7 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -99,10 +99,10 @@ class PlexAPI: search_choices = self.get_search_choices(final_search, key=final_search.endswith("Language")) valid_list = [] for value in util.get_list(data): - if str(value).lower in search_choices: - valid_list.append(search_choices[str(value).lower]) + if str(value).lower() in search_choices: + valid_list.append(search_choices[str(value).lower()]) else: - raise Failed(f"Plex Error: No {search_name}: {value} found") + raise Failed(f"Plex Error: {search_name}: {value} not found") return valid_list def get_all_collections(self):