fixed problem with specified template and error

just found a small edge case that broke metadata working on files with manually specified templates, and corrected a spelling mistake that resulted in an error
This commit is contained in:
pine 2021-07-24 19:11:09 +00:00
parent 36578a7414
commit c8d6509c71
Signed by: pine
GPG Key ID: 66AAFCFCCFBB559E
1 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ def get_meta(file, target):
found = False
with open(file, 'r') as f:
line = '&'
while line.startswith("&"):
while line.startswith("&") or line.startswith("!"):
line = f.readline()
if line[:len(target)+1].lower() == '&' + target.lower():
found = True
@ -288,7 +288,7 @@ def make(SOURCE_DIR=SOURCE_DIR,
elif rl[0].startswith("!TEMPLATE"):
#TEMPLATE CASE 1: It's explicitely written out
try:
with open(TEMPLATE_DIR + r[0][10:] + ".template", 'r') as tfile:
with open(TEMPLATE_DIR + rl[0][10:] + ".template", 'r') as tfile:
template = tfile.read().splitlines()
except:
add_message("Template '%s' specified but does not exist" % r[0][10:])