[SCM] morituri/master: * TODO: * morituri/common/program.py: * morituri/rip/cd.py: Add rip cd rip --release-id as an option to select the exact release this disc is a part of. Fixes Radiohead - Pablo Honey and U2 - Achtung Baby

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


The following commit has been merged in the master branch:
commit c4e170daad4cf6ea3137d5c7b8b92a52bc07d0a0
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Mon Jan 23 10:09:24 2012 +0000

    	* TODO:
    	* morituri/common/program.py:
    	* morituri/rip/cd.py:
    	  Add rip cd rip --release-id as an option to select the exact
    	  release this disc is a part of.
    	  Fixes Radiohead - Pablo Honey and U2 - Achtung Baby

diff --git a/ChangeLog b/ChangeLog
index c17a9b0..93539bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* TODO:
+	* morituri/common/program.py:
+	* morituri/rip/cd.py:
+	  Add rip cd rip --release-id as an option to select the exact
+	  release this disc is a part of.
+	  Fixes Radiohead - Pablo Honey and U2 - Achtung Baby
+
 2012-01-22  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/rip/debug.py:
diff --git a/TODO b/TODO
index 4b1927c..e527b03 100644
--- a/TODO
+++ b/TODO
@@ -50,6 +50,5 @@ TODO:
   complain if it was, to not overwrite
 - if multiple releases with different artist match the disc id, stop and
   let user continue by choosing one
-- on multiple hits with different titles/disc numbers, ask user to choose by specifying first few letters of correct release/album id; redo radiohead - pablo honey
 - artist-credit-phrase fabricated by musicbrainzngs only looks at name, not at artist-credit->name (see e.g. Gorky)
 - getting cache results should depend on same drive/offset
diff --git a/morituri/common/program.py b/morituri/common/program.py
index 531d435..0fa453f 100644
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@ -223,7 +223,7 @@ class Program(log.Loggable):
         return None
 
 
-    def getMusicBrainz(self, ittoc, mbdiscid):
+    def getMusicBrainz(self, ittoc, mbdiscid, release=None):
         # look up disc on musicbrainz
         print 'Disc duration: %s' % common.formatTime(
             ittoc.duration() / 1000.0)
@@ -272,6 +272,20 @@ class Program(log.Loggable):
 
             # If we have multiple, make sure they match
             metadatas = deltas[lowest]
+
+            if release:
+                metadatas = [m for m in metadatas if m.url.endswith(release)]
+                self.debug('Asked for release %r, only kept %r',
+                    release, metadatas)
+                if len(metadatas) == 1:
+                    print
+                    print 'Picked requested release id %s' % release
+                    print 'Artist : %s' % metadatas[0].artist.encode('utf-8')
+                    print 'Title :  %s' % metadatas[0].title.encode('utf-8')
+                elif not metadatas:
+                    print 'Requested release id %s but none match' % release
+                    return
+
             if len(metadatas) > 1:
                 artist = metadatas[0].artist
                 releaseTitle = metadatas[0].releaseTitle
@@ -289,8 +303,8 @@ class Program(log.Loggable):
                     print
                     print 'Picked closest match in duration.'
                     print 'Others may be wrong in musicbrainz, please correct.'
-                    print 'Artist : %s' % artist
-                    print 'Title :  %s' % metadatas[0].title
+                    print 'Artist : %s' % artist.encode('utf-8')
+                    print 'Title :  %s' % metadatas[0].title.encode('utf-8')
 
             # Select one of the returned releases. We just pick the first one.
             ret = metadatas[0]
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index a6dc57e..ff070a7 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -81,6 +81,10 @@ filling in the variables and expanding the file extension. Variables are:
             action="store", dest="disc_template",
             help="template for disc file naming (default %default)",
             default=DEFAULT_DISC_TEMPLATE)
+        self.parser.add_option('-R', '--release-id',
+            action="store", dest="release",
+            help="MusicBrainz release id to match to (if there are multiple)")
+
         default = 'flac'
 
         # here to avoid import gst eating our options
@@ -95,8 +99,6 @@ filling in the variables and expanding the file extension. Variables are:
             action="store_true", dest="unknown",
             help="whether to continue ripping if the CD is unknown (%default)",
             default=False)
-        default = 'flac'
-
 
     def handleOptions(self, options):
         options.track_template = options.track_template.decode('utf-8')
@@ -148,7 +150,8 @@ See  http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
 
         print "MusicBrainz lookup URL", ittoc.getMusicBrainzSubmitURL()
 
-        prog.metadata = prog.getMusicBrainz(ittoc, mbdiscid)
+        prog.metadata = prog.getMusicBrainz(ittoc, mbdiscid,
+            self.options.release)
 
         if not prog.metadata:
             # fall back to FreeDB for lookup

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list