* morituri/rip/cd.py:

Templates should have same number of slashes.
	  This avoids #66.
	  (Possibly, it should also be the same directory, or more code
	   should be written to handle that case).
	* morituri/rip/main.py:
	  Catch CommandError.
This commit is contained in:
Thomas Vander Stichele
2011-05-30 18:25:40 +00:00
parent 263260f820
commit ffbc4268fd
3 changed files with 28 additions and 2 deletions

View File

@@ -1,3 +1,13 @@
2011-05-30 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/rip/cd.py:
Templates should have same number of slashes.
This avoids #66.
(Possibly, it should also be the same directory, or more code
should be written to handle that case).
* morituri/rip/main.py:
Catch CommandError.
2011-05-30 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/rip/cd.py:

View File

@@ -31,6 +31,8 @@ from morituri.common import drive, program
from morituri.result import result
from morituri.program import cdrdao
from morituri.extern.command import command
DEFAULT_TRACK_TEMPLATE = u'%A - %d/%t. %a - %n'
DEFAULT_DISC_TEMPLATE = u'%A - %d/%A - %d'
@@ -40,13 +42,15 @@ class Rip(logcommand.LogCommand):
description = """
Rips a CD.
Tracks are named according to the track template:
Tracks are named according to the track template, filling in the variables
and expanding the file extension. Variables are:
- %t: track number
- %a: track artist
- %n: track title
- %s: track sort name
Discs are named according to the disc template:
Disc files (.cue, .log, .m3u) are named according to the disc template,
filling in the variables and expanding the file extension. Variables are:
- %A: album artist
- %S: album sort name
- %d: disc title
@@ -99,6 +103,13 @@ Discs are named according to the disc template:
options.track_template = options.track_template.decode('utf-8')
options.disc_template = options.disc_template.decode('utf-8')
slashCountT = len(options.track_template.split(os.path.sep))
slashCountD = len(options.disc_template.split(os.path.sep))
if slashCountT != slashCountD:
raise command.CommandError(
"The number of path separators in the templates " \
"should be the same.")
def do(self, args):
prog = program.Program()
runner = task.SyncRunner()

View File

@@ -6,6 +6,8 @@ import sys
from morituri.common import log, logcommand, common, task
from morituri.rip import cd, offset, drive, image, accurip, debug
from morituri.extern.command import command
def main(argv):
c = Rip()
try:
@@ -38,6 +40,9 @@ cdrdao says:
return 255
raise
except command.CommandError, e:
sys.stderr.write('rip: error: %s\n' % e.output)
return e.status
if ret is None:
return 0