From fa1fba9bc270165392b936b0734d1902c6cfe488 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 19 Oct 2011 18:15:42 +0000 Subject: [PATCH] * morituri/rip/debug.py: Add rip debug musicbrainz command to look up information on disc id's. --- ChangeLog | 6 ++++++ morituri/rip/debug.py | 30 +++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6bf753..5098ba7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-10-19 Thomas Vander Stichele + + * morituri/rip/debug.py: + Add rip debug musicbrainz command to look up information on + disc id's. + 2011-10-19 Thomas Vander Stichele * morituri/common/Makefile.am: diff --git a/morituri/rip/debug.py b/morituri/rip/debug.py index 8e076d4..dac5972 100644 --- a/morituri/rip/debug.py +++ b/morituri/rip/debug.py @@ -82,9 +82,33 @@ class Encode(logcommand.LogCommand): runner.run(encodetask) +class MusicBrainz(logcommand.LogCommand): + + summary = "examine MusicBrainz info" + + + def do(self, args): + try: + discId = unicode(args[0]) + except IndexError: + self.stdout.write('Please specify a MusicBrainz disc id.\n') + return 3 + + from morituri.common import program + metadatas = program.musicbrainz(discId) + + self.stdout.write('%d releases\n' % len(metadatas)) + for i, md in enumerate(metadatas): + self.stdout.write('- Release %d:\n' % (i + 1, )) + self.stdout.write(' Artist: %r\n' % md.artist) + self.stdout.write(' Title: %r\n' % md.title) + self.stdout.write(' URL: %r\n' % md.url) + self.stdout.write(' Tracks: %r\n' % len(md.tracks)) + for j, track in enumerate(md.tracks): + self.stdout.write(' Track %2d: %r - %r\n' % ( + j, track.artist, track.title)) + class Debug(logcommand.LogCommand): summary = "debug internals" - subCommandClasses = [Checksum, Encode, ] - - + subCommandClasses = [Checksum, Encode, MusicBrainz, ]