Introduce %M, %N template variables

- %M: total number of discs in the chosen release
- %N: number of current disc

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2021-05-15 16:40:29 +00:00
parent 76b8004b8f
commit 1edd3657ba
5 changed files with 20 additions and 5 deletions

View File

@@ -277,9 +277,9 @@ def getRelativePath(targetPath, collectionPath):
def validate_template(template, kind):
"""Raise exception if disc/track template includes invalid variables."""
if kind == 'disc':
matches = re.findall(r'%[^ABCDIRSTXcdrxy]', template)
matches = re.findall(r'%[^ABCDIMNRSTXcdrxy]', template)
elif kind == 'track':
matches = re.findall(r'%[^ABCDIRSTXacdnrstxy]', template)
matches = re.findall(r'%[^ABCDIMNRSTXacdnrstxy]', template)
if '%' in template and matches:
raise ValueError(kind + ' template string contains invalid '
'variable(s): {}'.format(', '.join(matches)))