[36] anidb fix

pull/1040/head
meisnate12 2 years ago
parent a67b6db007
commit b2af8f06cc

@ -48,7 +48,7 @@ jobs:
webhook_id: ${{ secrets.DEVELOP_WEBHOOK_ID }}
webhook_token: ${{ secrets.DEVELOP_WEBHOOK_TOKEN }}
title: Plex Meta Manager Develop Commits
message: "<@&954835263731949623>"
message: "<@&954835263731949623> - An update to Plex Meta Manager has been published and is available to users of the **develop** branch."
commits: "true"
username: Metabot
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/develop/.github/pmm.png

@ -48,7 +48,7 @@ jobs:
webhook_id: ${{ secrets.NIGHTLY_WEBHOOK_ID }}
webhook_token: ${{ secrets.NIGHTLY_WEBHOOK_TOKEN }}
title: Nightly Commits
message: "<@&967002147520675840>"
message: "<@&967002147520675840> - An update to Plex Meta Manager has now been published and is available to users of the **nightly** branch."
commits: "true"
username: Metabot
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/nightly/.github/pmm.png

@ -18,6 +18,6 @@ jobs:
webhook_token: ${{ secrets.RELEASE_WEBHOOK_TOKEN }}
release: true
title: Plex Meta Manager Release VERSION
message: "<@&967002324646113290>"
message: "<@&967002324646113290> - A new version of Plex Meta Manager has been released and is available to all users"
username: Metabot
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/pmm.png

@ -1 +1 @@
1.17.3-develop35
1.17.3-develop36

@ -25,7 +25,7 @@ class AniDBObj:
try:
if isinstance(data, dict):
if is_list:
return data[attr].split("|")
return data[attr].split("|") if data[attr] else []
elif is_dict:
return json.loads(data[attr])
elif is_float:

@ -39,7 +39,7 @@ boolean_details = [
scheduled_boolean = ["visible_library", "visible_home", "visible_shared"]
string_details = ["sort_title", "content_rating", "name_mapping"]
ignored_details = [
"smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "test", "suppress_overlays",
"smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "variables", "test", "suppress_overlays",
"delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "builder_level", "overlay",
"validate_builders", "libraries", "sync_to_users", "collection_name", "playlist_name", "name", "blank_collection",
"allowed_library_types", "delete_playlist", "ignore_blank_results"
@ -208,9 +208,15 @@ class CollectionBuilder:
methods["name"] = "name"
if "template" in methods:
if "variables" in methods:
logger.debug("")
logger.debug("Validating Method: variables")
if not isinstance(self.data[methods["variables"]], dict):
raise Failed(f"{self.Type} Error: variables must be a dictionary (key: value pairs)")
logger.trace(self.data[methods["variables"]])
logger.debug("")
name = self.data[methods["name"]] if "name" in methods else None
new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]])
new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]], self.data[methods["variables"]])
for attr in new_attributes:
if attr.lower() not in methods:
self.data[attr] = new_attributes[attr]

@ -106,7 +106,7 @@ class DataFile:
raise Failed(f"File Error: File does not exist {os.path.abspath(file_path)}")
return yaml.data
def apply_template(self, name, mapping_name, data, template_call):
def apply_template(self, name, mapping_name, data, template_call, extra_variables):
if not self.templates:
raise Failed(f"{self.data_type} Error: No templates found")
elif not template_call:
@ -129,13 +129,12 @@ class DataFile:
logger.debug(f"Call: {variables}")
remove_variables = []
optional = []
for tm in variables:
if variables[tm] is None:
remove_variables.append(tm)
optional = []
for remove_variable in remove_variables:
variables.pop(remove_variable)
optional.append(str(remove_variable))
variables.pop(tm)
optional.append(str(tm))
template, temp_vars = self.templates[variables["name"]]
@ -153,7 +152,13 @@ class DataFile:
for temp_key, temp_value in temp_vars.items():
if temp_value is None:
optional.append(str(temp_key))
else:
elif temp_key not in variables:
variables[temp_key] = temp_value
for temp_key, temp_value in extra_variables.items():
if temp_value is None:
optional.append(str(temp_key))
elif temp_key not in variables:
variables[temp_key] = temp_value
for temp_key, temp_value in self.temp_vars.items():

@ -997,6 +997,8 @@ class Plex(Library):
display += f"+{', +'.join(_add)}"
if _remove:
self.query_data(getattr(obj, f"remove{attr_call}"), _remove)
if display:
display += ", "
display += f"-{', -'.join(_remove)}"
final = f"{obj.title[:25]:<25} | {attr_display} | {display}" if display else display
if do_print and final:

Loading…
Cancel
Save