[21] allow blank changes_webhook

pull/847/head
meisnate12 3 years ago
parent 8591483eb0
commit 07c0e1a4d5

@ -1 +1 @@
1.16.3-develop20 1.16.3-develop21

@ -839,7 +839,7 @@ class CollectionBuilder:
else: else:
self.details[method_final] = util.get_list(method_data) if method_data else [] self.details[method_final] = util.get_list(method_data) if method_data else []
elif method_name == "changes_webhooks": elif method_name == "changes_webhooks":
self.details[method_name] = util.parse(self.Type, method_name, method_data, datatype="list") self.details[method_name] = util.parse(self.Type, method_name, method_data, datatype="list") if method_data else None
elif method_name in scheduled_boolean: elif method_name in scheduled_boolean:
if isinstance(method_data, bool): if isinstance(method_data, bool):
self.details[method_name] = method_data self.details[method_name] = method_data

@ -20,6 +20,10 @@ auto = {
"Artist": ["mood", "style", "country"] + all_auto, "Artist": ["mood", "style", "country"] + all_auto,
"Video": ["country", "content_rating"] + all_auto "Video": ["country", "content_rating"] + all_auto
} }
dynamic_attributes = [
"type", "data", "exclude", "addons", "template", "template_variables", "other_template", "remove_suffix",
"remove_prefix", "title_format", "key_name_override", "title_override", "test", "sync", "include", "other_name"
]
auto_type_translation = {"content_rating": "contentRating", "subtitle_language": "subtitleLanguage", "audio_language": "audioLanguage"} auto_type_translation = {"content_rating": "contentRating", "subtitle_language": "subtitleLanguage", "audio_language": "audioLanguage"}
default_templates = { default_templates = {
"original_language": {"plex_all": True, "filters": {"original_language": "<<value>>"}}, "original_language": {"plex_all": True, "filters": {"original_language": "<<value>>"}},
@ -279,6 +283,9 @@ class MetadataFile(DataFile):
logger.info("") logger.info("")
try: try:
methods = {dm.lower(): dm for dm in dynamic} methods = {dm.lower(): dm for dm in dynamic}
for m in methods:
if m not in dynamic_attributes:
logger.warning(f"Config Warning: {methods[m]} attribute is invalid. Options: {', '.join(dynamic_attributes)}")
if "type" not in methods: if "type" not in methods:
raise Failed(f"Config Error: {map_name} type attribute not found") raise Failed(f"Config Error: {map_name} type attribute not found")
elif not dynamic[methods["type"]]: elif not dynamic[methods["type"]]:
@ -307,8 +314,8 @@ class MetadataFile(DataFile):
def _check_dict(check_dict): def _check_dict(check_dict):
for ck, cv in check_dict.items(): for ck, cv in check_dict.items():
all_keys.append(ck) all_keys.append(ck)
if ck not in exclude and cv not in exclude: if str(ck) not in exclude and str(cv) not in exclude:
auto_list[ck] = cv auto_list[str(ck)] = cv
if auto_type == "decade" and library.is_show: if auto_type == "decade" and library.is_show:
all_items = library.get_all() all_items = library.get_all()
if addons: if addons:
@ -364,7 +371,7 @@ class MetadataFile(DataFile):
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: if tmdb_item and tmdb_item.collection_id:
all_keys.append(str(tmdb_item.collection_id)) all_keys.append(str(tmdb_item.collection_id))
if tmdb_item.collection_id not in exclude and tmdb_item.collection_name not in exclude: 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 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":

@ -474,6 +474,8 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
if datatype in ["list", "commalist", "strlist"]: if datatype in ["list", "commalist", "strlist"]:
final_list = [] final_list = []
if value: if value:
if datatype in ["commalist", "strlist"] and isinstance(value, dict):
raise Failed(f"{error} Error: {display} {value} must be a list or string")
if datatype == "commalist": if datatype == "commalist":
value = get_list(value) value = get_list(value)
if not isinstance(value, list): if not isinstance(value, list):
@ -483,7 +485,7 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
if options is None or (options and (v in options or (datatype == "strlist" and str(v) in options))): if options is None or (options and (v in options or (datatype == "strlist" and str(v) in options))):
final_list.append(str(v) if datatype == "strlist" else v) final_list.append(str(v) if datatype == "strlist" else v)
elif options: elif options:
raise Failed(f"{error} Error: {v} is invalid; Options include: {options}") raise Failed(f"{error} Error: {display} {v} is invalid; Options include: {', '.join(options)}")
return final_list return final_list
elif datatype == "intlist": elif datatype == "intlist":
if value: if value:

Loading…
Cancel
Save