[SCM] morituri/master: * morituri/common/musicbrainzngs.py: * morituri/rip/debug.py: Also store releaseType for disc metadata.

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


The following commit has been merged in the master branch:
commit cf8f505d82182f4904f844b47a76e9413a075f80
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sat Dec 22 18:17:05 2012 +0000

    	* morituri/common/musicbrainzngs.py:
    	* morituri/rip/debug.py:
    	  Also store releaseType for disc metadata.

diff --git a/ChangeLog b/ChangeLog
index 14244ca..5445830 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-22  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/musicbrainzngs.py:
+	* morituri/rip/debug.py:
+	  Also store releaseType for disc metadata.
+
 2012-12-06  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/program.py:
diff --git a/morituri/common/musicbrainzngs.py b/morituri/common/musicbrainzngs.py
index ba46091..9c082e2 100644
--- a/morituri/common/musicbrainzngs.py
+++ b/morituri/common/musicbrainzngs.py
@@ -69,6 +69,7 @@ class DiscMetadata(object):
     release = None
 
     releaseTitle = None
+    releaseType = None
 
     mbid = None
     mbidArtist = None
@@ -89,7 +90,7 @@ def _record(record, which, name, what):
         log.info('musicbrainzngs', 'Wrote %s %s to %s', which, name, filename)
 
 
-def _getMetadata(release, discid):
+def _getMetadata(releaseShort, release, discid):
     """
     @type  release: C{dict}
     @param release: a release dict as returned in the value for key release
@@ -107,6 +108,7 @@ def _getMetadata(release, discid):
 
     metadata = DiscMetadata()
 
+    metadata.releaseType = releaseShort['release-group'].get('type')
     credit = release['artist-credit']
 
     artist = credit[0]['artist']
@@ -246,9 +248,11 @@ def musicbrainz(discid, record=False):
 
     # Display the returned results to the user.
 
+    import json
     for release in result['disc']['release-list']:
-        log.debug('program', 'result %r: artist %r, title %r' % (
-            release, release['artist-credit-phrase'], release['title']))
+        formatted = json.dumps(release, sort_keys=False, indent=4)
+        log.debug('program', 'result %s: artist %r, title %r' % (
+            formatted, release['artist-credit-phrase'], release['title']))
 
         # to get titles of recordings, we need to query the release with
         # artist-credits
@@ -256,9 +260,11 @@ def musicbrainz(discid, record=False):
         res = musicbrainz.get_release_by_id(release['id'],
             includes=["artists", "artist-credits", "recordings", "discids"])
         _record(record, 'release', release['id'], res)
-        release = res['release']
+        releaseDetail = res['release']
+        formatted = json.dumps(releaseDetail, sort_keys=False, indent=4)
+        log.debug('program', 'release %s' % formatted)
 
-        md = _getMetadata(release, discid)
+        md = _getMetadata(release, releaseDetail, discid)
         if md:
             log.debug('program', 'duration %r', md.duration)
             ret.append(md)
diff --git a/morituri/rip/debug.py b/morituri/rip/debug.py
index 0dfbe48..6614f55 100644
--- a/morituri/rip/debug.py
+++ b/morituri/rip/debug.py
@@ -180,7 +180,11 @@ class Tag(logcommand.LogCommand):
 
 class MusicBrainzNGS(logcommand.LogCommand):
 
+    usage = "[MusicBrainz disc id]"
     summary = "examine MusicBrainz NGS info"
+    description = """Look up a MusicBrainz disc id and output information.
+
+Example disc id: KnpGsLhvH.lPrNc1PBL21lb9Bg4-"""
 
     def do(self, args):
         try:
@@ -197,6 +201,7 @@ class MusicBrainzNGS(logcommand.LogCommand):
             self.stdout.write('- Release %d:\n' % (i + 1, ))
             self.stdout.write('    Artist: %s\n' % md.artist.encode('utf-8'))
             self.stdout.write('    Title:  %s\n' % md.title.encode('utf-8'))
+            self.stdout.write('    Type:   %s\n' % md.releaseType.encode('utf-8'))
             self.stdout.write('    URL: %s\n' % md.url)
             self.stdout.write('    Tracks: %d\n' % len(md.tracks))
             for j, track in enumerate(md.tracks):

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list