[SCM] morituri/master: * morituri/common/musicbrainzngs.py: Fix case of metadata not having length. Fix case of release not having a date.

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


The following commit has been merged in the master branch:
commit cd6865c9d2f4d110b9c781f91c6172b42d74cc05
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Fri Oct 28 16:36:39 2011 +0000

    	* morituri/common/musicbrainzngs.py:
    	  Fix case of metadata not having length.
    	  Fix case of release not having a date.

diff --git a/ChangeLog b/ChangeLog
index 5b70da5..314a23f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-28  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/musicbrainzngs.py:
+	  Fix case of metadata not having length.
+	  Fix case of release not having a date.
+
 2011-10-22  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/Makefile.am:
diff --git a/morituri/common/musicbrainzngs.py b/morituri/common/musicbrainzngs.py
index a4ac957..96aeff3 100644
--- a/morituri/common/musicbrainzngs.py
+++ b/morituri/common/musicbrainzngs.py
@@ -24,7 +24,6 @@
 Handles communication with the musicbrainz server using NGS.
 """
 
-import urlparse
 import urllib2
 
 from morituri.common import log
@@ -106,7 +105,10 @@ def _getMetadata(release, discid):
     metadata.artist = artist['name']
     metadata.sortName = artist['sort-name']
     # FIXME: is format str ?
-    metadata.release = release['date']
+    if not release.has_key('date'):
+        log.warning('musicbrainzngs', 'Release %r does not have date', release)
+    else:
+        metadata.release = release['date']
 
     metadata.mbid = release['id']
     metadata.mbidArtist = artist['id']
@@ -151,7 +153,7 @@ def _getMetadata(release, discid):
                     track.mbid = t['recording']['id']
 
                     # FIXME: unit of duration ?
-                    track.duration = int(t['recording']['length'])
+                    track.duration = int(t['recording'].get('length', 0))
                     if not track.duration:
                         log.warning('getMetadata',
                             'track %r (%r) does not have duration' % (

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list