* morituri/common/program.py:
* morituri/rip/cd.py: feature: add %x for extension to track/disc template.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2012-12-23 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/program.py:
|
||||
* morituri/rip/cd.py:
|
||||
feature: add %x for extension to track/disc template.
|
||||
|
||||
2012-12-22 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/program.py:
|
||||
|
||||
@@ -136,7 +136,7 @@ class Program(log.Loggable):
|
||||
def saveRipResult(self):
|
||||
self._presult.persist()
|
||||
|
||||
def getPath(self, outdir, template, mbdiscid, i):
|
||||
def getPath(self, outdir, template, mbdiscid, i, profile=None):
|
||||
"""
|
||||
Based on the template, get a complete path for the given track,
|
||||
minus extension.
|
||||
@@ -148,6 +148,7 @@ class Program(log.Loggable):
|
||||
@type template: unicode
|
||||
@param i: track number (0 for HTOA, or for disc)
|
||||
@type i: int
|
||||
@type profile: L{morituri.common.encode.Profile}
|
||||
|
||||
@rtype: unicode
|
||||
"""
|
||||
@@ -168,6 +169,7 @@ class Program(log.Loggable):
|
||||
v['d'] = mbdiscid # fallback for title
|
||||
v['r'] = 'unknown'
|
||||
v['R'] = 'Unknown'
|
||||
v['x'] = profile and profile.extension or 'unknown'
|
||||
|
||||
v['a'] = v['A']
|
||||
if i == 0:
|
||||
@@ -182,8 +184,9 @@ class Program(log.Loggable):
|
||||
v['A'] = filterForPath(self.metadata.artist)
|
||||
v['S'] = filterForPath(self.metadata.sortName)
|
||||
v['d'] = filterForPath(self.metadata.title)
|
||||
v['R'] = self.metadata.releaseType
|
||||
v['r'] = self.metadata.releaseType.lower()
|
||||
if self.metadata.releaseType:
|
||||
v['R'] = self.metadata.releaseType
|
||||
v['r'] = self.metadata.releaseType.lower()
|
||||
if i > 0:
|
||||
try:
|
||||
v['a'] = filterForPath(self.metadata.tracks[i - 1].artist)
|
||||
|
||||
@@ -42,22 +42,27 @@ MAX_TRIES = 5
|
||||
class Rip(logcommand.LogCommand):
|
||||
summary = "rip CD"
|
||||
|
||||
# see morituri.common.program.Program.getPath for expansion
|
||||
description = """
|
||||
Rips a CD.
|
||||
|
||||
Tracks are named according to the track template, filling in the variables
|
||||
and expanding the file extension. Variables are:
|
||||
and adding the file extension. Variables exclusive to the track template are:
|
||||
- %t: track number
|
||||
- %a: track artist
|
||||
- %n: track title
|
||||
- %s: track sort name
|
||||
|
||||
Disc files (.cue, .log, .m3u) are named according to the disc template,
|
||||
filling in the variables and expanding the file extension. Variables are:
|
||||
filling in the variables and adding the file extension. Variables for both
|
||||
disc and track template are:
|
||||
- %A: album artist
|
||||
- %S: album sort name
|
||||
- %d: disc title
|
||||
- %y: release year
|
||||
- %r: release type, lowercase
|
||||
- %r: Release type, normal case
|
||||
- %x: audio extension
|
||||
|
||||
Paths to track files referenced in .cue and .m3u files will be made
|
||||
relative to the directory of the disc files.
|
||||
@@ -261,7 +266,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
trackResult.filename)
|
||||
|
||||
path = prog.getPath(prog.outdir, self.options.track_template,
|
||||
mbdiscid, number) + '.' + profile.extension
|
||||
mbdiscid, number, profile=profile) + '.' + profile.extension
|
||||
self.debug('ripIfNotRipped: path %r' % path)
|
||||
trackResult.number = number
|
||||
|
||||
@@ -368,7 +373,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
|
||||
### write disc files
|
||||
discName = prog.getPath(prog.outdir, self.options.disc_template,
|
||||
mbdiscid, 0)
|
||||
mbdiscid, 0, profile=profile)
|
||||
dirname = os.path.dirname(discName)
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
@@ -399,7 +404,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
continue
|
||||
|
||||
path = prog.getPath(prog.outdir, self.options.track_template,
|
||||
mbdiscid, i + 1) + '.' + profile.extension
|
||||
mbdiscid, i + 1, profile=profile) + '.' + profile.extension
|
||||
writeFile(handle, path,
|
||||
itable.getTrackLength(i + 1) / common.FRAMES_PER_SECOND)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user