Introduce %T (medium title) template variable
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
@@ -100,6 +100,7 @@ Template schemes
|
||||
| - %d: release title (with disambiguation)
|
||||
| - %D: disc title (without disambiguation)
|
||||
| - %I: MusicBrainz Disc ID
|
||||
| - %T: medium title
|
||||
| - %y: release year
|
||||
| - %r: release type, lowercase
|
||||
| - %R: release type, normal case
|
||||
|
||||
@@ -60,6 +60,7 @@ disc and track template are:
|
||||
- %d: release title (with disambiguation)
|
||||
- %D: disc title (without disambiguation)
|
||||
- %I: MusicBrainz Disc ID
|
||||
- %T: medium title
|
||||
- %y: release year
|
||||
- %r: release type, lowercase
|
||||
- %R: release type, normal case
|
||||
|
||||
@@ -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'%[^ABCDIRSXcdrxy]', template)
|
||||
matches = re.findall(r'%[^ABCDIRSTXcdrxy]', template)
|
||||
elif kind == 'track':
|
||||
matches = re.findall(r'%[^ABCDIRSXacdnrstxy]', template)
|
||||
matches = re.findall(r'%[^ABCDIRSTXacdnrstxy]', template)
|
||||
if '%' in template and matches:
|
||||
raise ValueError(kind + ' template string contains invalid '
|
||||
'variable(s): {}'.format(', '.join(matches)))
|
||||
|
||||
@@ -72,6 +72,8 @@ class DiscMetadata:
|
||||
:vartype releasetitle: str or None
|
||||
:cvar releaseDisambCmt: release disambiguation comment
|
||||
:vartype releaseDisambCmt: str or None
|
||||
:cvar mediumTitle: title of the medium
|
||||
:vartype mediumTitle: str or None
|
||||
:vartype tracks: list of :any:`TrackMetadata`
|
||||
:cvar countries: MusicBrainz release countries
|
||||
:vartype countries: list or None
|
||||
@@ -100,6 +102,7 @@ class DiscMetadata:
|
||||
catalogNumber = None
|
||||
barcode = None
|
||||
countries = None
|
||||
mediumTitle = None
|
||||
|
||||
def __init__(self):
|
||||
self.tracks = []
|
||||
@@ -300,6 +303,7 @@ def _getMetadata(release, discid=None, country=None):
|
||||
releaseTitle += ' (Disc %d of %d)' % (
|
||||
int(medium['position']), count)
|
||||
if 'title' in medium:
|
||||
discMD.mediumTitle = medium['title']
|
||||
releaseTitle += ": %s" % medium['title']
|
||||
discMD.releaseTitle = releaseTitle
|
||||
for t in medium['track-list']:
|
||||
|
||||
@@ -182,6 +182,7 @@ class Program:
|
||||
* ``%d``: release title (with disambiguation)
|
||||
* ``%D``: disc title (without disambiguation)
|
||||
* ``%I``: MusicBrainz Disc ID
|
||||
* ``%T``: medium title
|
||||
* ``%y``: release year
|
||||
* ``%r``: release type, lowercase
|
||||
* ``%R``: release type, normal case
|
||||
@@ -218,6 +219,7 @@ class Program:
|
||||
v['B'] = metadata.barcode
|
||||
v['C'] = metadata.catalogNumber
|
||||
v['c'] = metadata.releaseDisambCmt
|
||||
v['T'] = metadata.mediumTitle
|
||||
if metadata.releaseType:
|
||||
v['R'] = metadata.releaseType
|
||||
v['r'] = metadata.releaseType.lower()
|
||||
|
||||
Reference in New Issue
Block a user