* 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
This commit is contained in:
Thomas Vander Stichele
2012-01-23 10:09:24 +00:00
parent 7f19859542
commit c4e170daad
4 changed files with 32 additions and 7 deletions

View File

@@ -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> 2012-01-22 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/rip/debug.py: * morituri/rip/debug.py:

1
TODO
View File

@@ -50,6 +50,5 @@ TODO:
complain if it was, to not overwrite complain if it was, to not overwrite
- if multiple releases with different artist match the disc id, stop and - if multiple releases with different artist match the disc id, stop and
let user continue by choosing one 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) - 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 - getting cache results should depend on same drive/offset

View File

@@ -223,7 +223,7 @@ class Program(log.Loggable):
return None return None
def getMusicBrainz(self, ittoc, mbdiscid): def getMusicBrainz(self, ittoc, mbdiscid, release=None):
# look up disc on musicbrainz # look up disc on musicbrainz
print 'Disc duration: %s' % common.formatTime( print 'Disc duration: %s' % common.formatTime(
ittoc.duration() / 1000.0) ittoc.duration() / 1000.0)
@@ -272,6 +272,20 @@ class Program(log.Loggable):
# If we have multiple, make sure they match # If we have multiple, make sure they match
metadatas = deltas[lowest] 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: if len(metadatas) > 1:
artist = metadatas[0].artist artist = metadatas[0].artist
releaseTitle = metadatas[0].releaseTitle releaseTitle = metadatas[0].releaseTitle
@@ -289,8 +303,8 @@ class Program(log.Loggable):
print print
print 'Picked closest match in duration.' print 'Picked closest match in duration.'
print 'Others may be wrong in musicbrainz, please correct.' print 'Others may be wrong in musicbrainz, please correct.'
print 'Artist : %s' % artist print 'Artist : %s' % artist.encode('utf-8')
print 'Title : %s' % metadatas[0].title print 'Title : %s' % metadatas[0].title.encode('utf-8')
# Select one of the returned releases. We just pick the first one. # Select one of the returned releases. We just pick the first one.
ret = metadatas[0] ret = metadatas[0]

View File

@@ -81,6 +81,10 @@ filling in the variables and expanding the file extension. Variables are:
action="store", dest="disc_template", action="store", dest="disc_template",
help="template for disc file naming (default %default)", help="template for disc file naming (default %default)",
default=DEFAULT_DISC_TEMPLATE) 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' default = 'flac'
# here to avoid import gst eating our options # 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", action="store_true", dest="unknown",
help="whether to continue ripping if the CD is unknown (%default)", help="whether to continue ripping if the CD is unknown (%default)",
default=False) default=False)
default = 'flac'
def handleOptions(self, options): def handleOptions(self, options):
options.track_template = options.track_template.decode('utf-8') 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() 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: if not prog.metadata:
# fall back to FreeDB for lookup # fall back to FreeDB for lookup