[19] fix dynamic addons

pull/995/head
meisnate12 2 years ago
parent 7d85015c9f
commit 82b006bfa1

@ -1 +1 @@
1.17.2-develop18 1.17.2-develop19

@ -509,9 +509,10 @@ class MetadataFile(DataFile):
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}") logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
tmdb_id, tvdb_id, imdb_id = library.get_ids(item) tmdb_id, tvdb_id, imdb_id = library.get_ids(item)
tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=True) tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=True)
if tmdb_item and tmdb_item.collection_id and tmdb_item.collection_name and str(tmdb_item.collection_id) not in exclude and tmdb_item.collection_name not in exclude: if tmdb_item and tmdb_item.collection_id and tmdb_item.collection_name:
all_keys.append(str(tmdb_item.collection_id)) all_keys.append(str(tmdb_item.collection_id))
auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name if str(tmdb_item.collection_id) not in exclude and tmdb_item.collection_name not in exclude:
auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name
logger.exorcise() logger.exorcise()
elif auto_type == "original_language": elif auto_type == "original_language":
all_items = library.get_all() all_items = library.get_all()
@ -636,7 +637,7 @@ class MetadataFile(DataFile):
auto_list[add_key] = add_key auto_list[add_key] = add_key
addons[add_key] = final_keys addons[add_key] = final_keys
else: else:
logger.warning(f"Config Error: {add_key} Custom Key must have at least one Key") logger.warning(f"Config Warning: {add_key} Custom Key must have at least one Key")
title_format = default_title_format title_format = default_title_format
if "title_format" in self.temp_vars: if "title_format" in self.temp_vars:
title_format = util.parse("Config", "title_format", self.temp_vars["title_format"], parent="template_variable", default=default_title_format) title_format = util.parse("Config", "title_format", self.temp_vars["title_format"], parent="template_variable", default=default_title_format)
@ -654,7 +655,7 @@ class MetadataFile(DataFile):
test_override = [] test_override = []
for k, v in key_name_override.items(): for k, v in key_name_override.items():
if v in test_override: if v in test_override:
logger.warning(f"Config Error: {v} can only be used once skipping {k}: {v}") logger.warning(f"Config Warning: {v} can only be used once skipping {k}: {v}")
key_name_override.pop(k) key_name_override.pop(k)
else: else:
test_override.append(v) test_override.append(v)
@ -741,7 +742,7 @@ class MetadataFile(DataFile):
key_name = key_name[:-len(suffix)].strip() key_name = key_name[:-len(suffix)].strip()
key_value = [key] if key in all_keys else [] key_value = [key] if key in all_keys else []
if key in addons: if key in addons:
key_value.extend([a for a in addons[key] if a in all_keys and a != key]) key_value.extend([a for a in addons[key] if (a in all_keys or auto_type == "custom") and a != key])
used_keys.extend(key_value) used_keys.extend(key_value)
og_call = {"value": key_value, auto_type: key_value, "key_name": key_name, "key": key} og_call = {"value": key_value, auto_type: key_value, "key_name": key_name, "key": key}
for k, v in template_variables.items(): for k, v in template_variables.items():

@ -26,11 +26,14 @@ class Reciperr:
return valid_lists return valid_lists
def get_imdb_ids(self, method, data): def get_imdb_ids(self, method, data):
name = "StevenLu" if method == "stevenlu_popular" else "Reciperr"
logger.info(f"Processing {name} Movies")
if method == "reciperr_list": if method == "reciperr_list":
logger.info(f"Processing Reciperr Movies") ids = [(i["imdb_id"], "imdb") for i in self._request(data)]
return [(i["imdb_id"], "imdb") for i in self._request(data)]
elif method == "stevenlu_popular": elif method == "stevenlu_popular":
logger.info(f"Processing StevenLu Popular Movies") ids = [(i["imdb_id"], "imdb") for i in self._request(stevenlu_url, name="StevenLu")]
return [(i["imdb_id"], "imdb") for i in self._request(stevenlu_url, name="StevenLu")]
else: else:
raise Failed(f"Reciperr Error: Method {method} not supported") raise Failed(f"Config Error: Method {method} not supported")
if not ids:
raise Failed(f"{name} Error: No IDs found.")
return ids

Loading…
Cancel
Save