[SCM] morituri/master: key on musicbrainz disc id by default
    js at users.alioth.debian.org 
    js at users.alioth.debian.org
       
    Sun Oct 19 20:10:00 UTC 2014
    
    
  
The following commit has been merged in the master branch:
commit e3b168c2a1719e468644e0153ddb83790ea62696
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Feb 3 22:20:00 2013 +0100
    key on musicbrainz disc id by default
    
    Do not use cache if the mb disc id does not match the table cache value.
    
    Fixes asserts on the mb disc id differing.
    
    Fixes trac ticket 103.
diff --git a/morituri/common/program.py b/morituri/common/program.py
index 11da844..8c8be40 100644
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@ -67,11 +67,6 @@ class Program(log.Loggable):
         self._cache = cache.ResultCache()
         self._stdout = stdout
 
-    def _getTableCachePath(self):
-        path = os.path.join(os.path.expanduser('~'), '.morituri', 'cache',
-            'table')
-        return path
-
     def setWorkingDirectory(self, workingDirectory):
         if workingDirectory:
             self.info('Changing to working directory %s' % workingDirectory)
@@ -139,7 +134,7 @@ class Program(log.Loggable):
         assert toc.hasTOC()
         return toc
 
-    def getTable(self, runner, cddbdiscid, device):
+    def getTable(self, runner, cddbdiscid, mbdiscid, device):
         """
         Retrieve the Table either from the cache or the drive.
 
@@ -147,12 +142,13 @@ class Program(log.Loggable):
         """
         path = self._getTableCachePath()
 
-        pcache = cache.PersistedCache(path)
-        ptable = pcache.get(cddbdiscid)
+        tcache = cache.TableCache()
+        ptable = tcache.get(cddbdiscid, mbdiscid)
 
         if not ptable.object:
-            self.debug('getTable: cddbdiscid %s not in cache, reading table' %
-                cddbdiscid)
+            self.debug('getTable: cddbdiscid %s, mbdiscid %s not in cache, '
+                'reading table' % (
+                cddbdiscid, mbdiscid))
             t = cdrdao.ReadTableTask(device=device)
             runner.run(t)
             ptable.persist(t.table)
diff --git a/morituri/image/table.py b/morituri/image/table.py
index 2e2b81c..a34717a 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -368,7 +368,7 @@ class Table(object, log.Loggable):
         assert len(result) == 28, \
             "Result should be 28 characters, not %d" % len(result)
 
-        self.debug('getMusicBrainzDiscId: returning %r' % result)
+        self.log('getMusicBrainzDiscId: returning %r' % result)
         return result
 
     def getMusicBrainzSubmitURL(self):
@@ -455,7 +455,7 @@ class Table(object, log.Loggable):
                 pass
 
 
-        self.debug('Musicbrainz values: %r', result)
+        self.log('Musicbrainz values: %r', result)
         return result
 
     def getAccurateRipIds(self):
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index e7a2148..79ed8f7 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -94,7 +94,10 @@ class _CD(logcommand.LogCommand):
                 return -1
 
         # now, read the complete index table, which is slower
-        self.itable = self.program.getTable(self.runner, self.ittoc.getCDDBDiscId(), self.device)
+
+        self.itable = self.program.getTable(self.runner,
+            self.ittoc.getCDDBDiscId(),
+            self.ittoc.getMusicBrainzDiscId(), self.device)
 
         assert self.itable.getCDDBDiscId() == self.ittoc.getCDDBDiscId(), \
             "full table's id %s differs from toc id %s" % (
-- 
morituri packaging
    
    
More information about the pkg-multimedia-commits
mailing list