test attribute now works with templates

This commit is contained in:
meisnate12 2021-02-21 15:50:45 -05:00
parent 99b7bc55aa
commit 6958d3c897
2 changed files with 14 additions and 3 deletions

View file

@ -29,8 +29,7 @@ class CollectionBuilder:
elif not data["template"]:
raise Failed("Collection Error: template attribute is blank")
else:
template_list = data["template"] if isinstance(data["template"], list) else [data["template"]]
for data_template in template_list:
for data_template in util.get_list(data["template"], split=False):
if not isinstance(data_template, dict):
raise Failed("Collection Error: template attribute is not a dictionary")
elif "name" not in data_template:

View file

@ -348,7 +348,19 @@ class Config:
movie_map, show_map = self.map_guids(library)
for c in collections:
if test and ("test" not in collections[c] or collections[c]["test"] is not True):
continue
no_template_test = True
if "template" in collections[c] and collections[c]["template"]:
for data_template in util.get_list(collections[c]["template"], split=False):
if "name" in data_template \
and data_template["name"] \
and library.templates \
and data_template["name"] in self.library.templates \
and self.library.templates[data_template["name"]] \
and "test" in self.library.templates[data_template["name"]] \
and self.library.templates[data_template["name"]]["test"] == True:
no_template_test = False
if no_template_test:
continue
try:
logger.info("")
util.seperator("{} Collection".format(c))