[SCM] morituri/master: * morituri/common/config.py: * morituri/rip/cd.py: * morituri/rip/drive.py: Handle missing config better. Fixes #111.

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


The following commit has been merged in the master branch:
commit d9bf584c13aa902e6a16793ab9dd9a116ec23808
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Jan 6 21:31:03 2013 +0000

    	* morituri/common/config.py:
    	* morituri/rip/cd.py:
    	* morituri/rip/drive.py:
    	  Handle missing config better.
    	  Fixes #111.

diff --git a/ChangeLog b/ChangeLog
index b27e64a..f98473d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-01-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/config.py:
+	* morituri/rip/cd.py:
+	* morituri/rip/drive.py:
+	  Handle missing config better.
+	  Fixes #111.
+
 2013-01-02  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/config.py:
diff --git a/morituri/common/config.py b/morituri/common/config.py
index c4bf211..23e8eb5 100644
--- a/morituri/common/config.py
+++ b/morituri/common/config.py
@@ -81,7 +81,12 @@ class Config(log.Loggable):
         """
         section = self._findDriveSection(vendor, model, release)
 
-        return int(self._parser.get(section, 'read_offset'))
+        try:
+            return int(self._parser.get(section, 'read_offset'))
+        except ConfigParser.NoOptionError:
+            raise KeyError("Could not find read_offset for %s/%s/%s" % (
+                vendor, model, release))
+
 
     def setDefeatsCache(self, vendor, model, release, defeat):
         """
@@ -96,7 +101,11 @@ class Config(log.Loggable):
     def getDefeatsCache(self, vendor, model, release):
         section = self._findDriveSection(vendor, model, release)
 
-        return bool(self._parser.get(section, 'defeats_cache'))
+        try:
+            return bool(self._parser.get(section, 'defeats_cache'))
+        except ConfigParser.NoOptionError:
+            raise KeyError("Could not find defeats_cache for %s/%s/%s" % (
+                vendor, model, release))
 
     def write(self):
         fd, path = tempfile.mkstemp(suffix=u'.moriturirc')
@@ -126,7 +135,8 @@ class Config(log.Loggable):
 
             return name
 
-        raise KeyError
+        raise KeyError("Could not find configuration section for %s/%s/%s" % (
+                vendor, model, release))
 
     def _findOrCreateDriveSection(self, vendor, model, release):
         try:
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index df5a6b3..2284ed9 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -226,8 +226,8 @@ Log files will log the path to tracks relative to this directory.
             try:
                 prog.result.cdparanoiaDefeatsCache = self.getRootCommand(
                     ).config.getDefeatsCache(*info)
-            except (KeyError, ConfigParser.NoOptionError):
-                pass
+            except KeyError, e:
+                self.debug('Got key error: %r' % (e, ))
         prog.result.offset = int(self.options.offset)
         prog.result.artist = prog.metadata and prog.metadata.artist \
             or 'Unknown Artist'
diff --git a/morituri/rip/drive.py b/morituri/rip/drive.py
index adc1dc7..2bac282 100644
--- a/morituri/rip/drive.py
+++ b/morituri/rip/drive.py
@@ -110,7 +110,8 @@ class List(logcommand.LogCommand):
                 self.stdout.write(
                     "       Configured read offset: %d\n" % offset)
             except KeyError:
-                pass
+                self.stdout.write(
+                    "No read offset found.  Run 'rip offset find'\n")
 
         if not paths:
             self.stdout.write('No drives found.\n')

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list