diff --git a/man/whipper-cd-rip.rst b/man/whipper-cd-rip.rst index 4f1e57e..b4706db 100644 --- a/man/whipper-cd-rip.rst +++ b/man/whipper-cd-rip.rst @@ -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 diff --git a/whipper/command/cd.py b/whipper/command/cd.py index a3e3b37..f6bc2d6 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -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 diff --git a/whipper/common/common.py b/whipper/common/common.py index 76f1155..21a5f3c 100644 --- a/whipper/common/common.py +++ b/whipper/common/common.py @@ -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))) diff --git a/whipper/common/mbngs.py b/whipper/common/mbngs.py index b785ea3..0a35f82 100644 --- a/whipper/common/mbngs.py +++ b/whipper/common/mbngs.py @@ -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']: diff --git a/whipper/common/program.py b/whipper/common/program.py index 4f3ec44..3015162 100644 --- a/whipper/common/program.py +++ b/whipper/common/program.py @@ -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()