[SCM] morituri/master: * morituri/rip/main.py: Add the config object to the root command. * morituri/rip/offset.py: Save the drive's read offset when we find it.

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


The following commit has been merged in the master branch:
commit 1e980db4ef5f54e73a006bda2530c7cef8cbb802
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Dec 2 12:18:15 2012 +0000

    	* morituri/rip/main.py:
    	  Add the config object to the root command.
    	* morituri/rip/offset.py:
    	  Save the drive's read offset when we find it.

diff --git a/ChangeLog b/ChangeLog
index a2d1bf2..fda3ae2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-12-02  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* morituri/rip/main.py:
+	  Add the config object to the root command.
+	* morituri/rip/offset.py:
+	  Save the drive's read offset when we find it.
+
+2012-12-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri.spec.in:
 	* morituri/common/config.py:
 	  Use XDG if we can import xdg.
diff --git a/morituri/rip/main.py b/morituri/rip/main.py
index 60d13a8..bab3b8c 100644
--- a/morituri/rip/main.py
+++ b/morituri/rip/main.py
@@ -5,7 +5,7 @@ import os
 import sys
 import pkg_resources
 
-from morituri.common import log, logcommand, common
+from morituri.common import log, logcommand, common, config
 
 from morituri.rip import cd, offset, drive, image, accurip, debug
 
@@ -104,6 +104,8 @@ You can get help on subcommands by using the -h option to the subcommand.
 
         self.record = options.record
 
+        self.config = config.Config()
+
     def parse(self, argv):
         log.debug("morituri", "rip %s" % " ".join(argv))
         logcommand.LogCommand.parse(self, argv)
diff --git a/morituri/rip/offset.py b/morituri/rip/offset.py
index 39f55a6..03acdf6 100644
--- a/morituri/rip/offset.py
+++ b/morituri/rip/offset.py
@@ -188,8 +188,7 @@ CD in the AccurateRip database."""
                         count += 1
 
                 if count == len(table.tracks):
-                    self.stdout.write('\nRead offset of device is: %d.\n' %
-                        offset)
+                    self._foundOffset(device, offset)
                     return 0
                 else:
                     self.stdout.write(
@@ -225,6 +224,20 @@ CD in the AccurateRip database."""
         os.unlink(path)
         return "%08x" % t.checksum
 
+    def _foundOffset(self, device, offset):
+        self.stdout.write('\nRead offset of device is: %d.\n' %
+            offset)
+
+        info = drive.getDeviceInfo(device)
+        if not info:
+            return
+
+        self.stdout.write('Adding read offset to configuration file.\n')
+
+        self.getRootCommand().config.setReadOffset(info[0], info[1], info[2],
+            offset)
+
+        
 
 class Offset(logcommand.LogCommand):
     summary = "handle drive offsets"

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list