[2] fix metadata file assets

pull/1168/head
meisnate12 2 years ago
parent cd95d1d56c
commit 9a94861ced

@ -1 +1 @@
1.18.0-develop1
1.18.0-develop2

@ -252,6 +252,7 @@ class DataFile:
if not isinstance(template["default"], dict):
raise Failed(f"{self.data_type} Error: template sub-attribute default is not a dictionary")
init_defaults = template["default"]
all_init_defaults = {k: v for k, v in init_defaults.items()}
for input_dict, input_type, overwrite_call in [
(temp_vars, "External", False),
(extra_variables, "Definition", False),
@ -273,7 +274,7 @@ class DataFile:
if not isinstance(input_value, dict):
raise Failed(f"{self.data_type} Error: {input_type} template sub-attribute default is not a dictionary")
for dk, dv in input_value.items():
init_defaults[dk] = dv
all_init_defaults[dk] = dv
elif input_value is None:
optional.append(str(input_key))
elif overwrite_call:
@ -310,8 +311,8 @@ class DataFile:
return return_item
default = {}
if init_defaults:
var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in init_defaults.items() if dk not in variables}
if all_init_defaults:
var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in all_init_defaults.items() if dk not in variables}
for dkey, dvalue in var_default.items():
final_key = replace_var(dkey, var_default)
final_value = replace_var(dvalue, var_default)
@ -326,7 +327,7 @@ class DataFile:
if op not in default and op not in conditionals:
optional.append(str(op))
optional.append(f"{op}_encoded")
else:
elif op in init_defaults:
logger.debug("")
logger.debug(f"Template Warning: variable {op} cannot be optional if it has a default")
else:
@ -1243,7 +1244,7 @@ class MetadataFile(DataFile):
logger.info(f"{self.library.type}: {mapping_name} Details Update {'Complete' if updated else 'Not Needed'}")
asset_location, folder_name = self.library.item_images(item, meta, methods, initial=True, asset_location=self.asset_directory if self.asset_directory else None)
asset_location, folder_name = self.library.item_images(item, meta, methods, initial=True, asset_directory=self.asset_directory + self.library.asset_directory if self.asset_directory else None)
if "seasons" in methods and self.library.is_show:
if not meta[methods["seasons"]]:

@ -1045,12 +1045,12 @@ class Plex(Library):
logger.info(final)
return final[28:] if final else final
def item_images(self, item, group, alias, initial=False, asset_location=None, title=None, image_name=None, folder_name=None):
def item_images(self, item, group, alias, initial=False, asset_location=None, asset_directory=None, title=None, image_name=None, folder_name=None):
if title is None:
title = item.title
posters, backgrounds = util.get_image_dicts(group, alias)
try:
asset_poster, asset_background, item_dir, folder_name = self.find_item_assets(item, item_asset_directory=asset_location)
asset_poster, asset_background, item_dir, folder_name = self.find_item_assets(item, item_asset_directory=asset_location, asset_directory=asset_directory)
if asset_poster:
posters["asset_directory"] = asset_poster
if asset_background:

Loading…
Cancel
Save