mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-26 06:20:23 +00:00
fixes #142 and other bugs
This commit is contained in:
parent
63f901fb03
commit
7da12bc33c
3 changed files with 15 additions and 14 deletions
|
@ -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":
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue