[SCM] morituri/master: * 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.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:30 UTC 2014


The following commit has been merged in the master branch:
commit ffbc4268fd1169c9ac5807d29244252a37b90910
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Mon May 30 18:25:40 2011 +0000

    	* 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.

diff --git a/ChangeLog b/ChangeLog
index c4a1fa9..9400bf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 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:
 	  Create variables for default templates.
 
 2011-05-30  Thomas Vander Stichele  <thomas at apestaart dot org>
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 3295152..85b0007 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -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()
diff --git a/morituri/rip/main.py b/morituri/rip/main.py
index 3822f3e..7a4e5d9 100644
--- a/morituri/rip/main.py
+++ b/morituri/rip/main.py
@@ -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

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list