[SCM] morituri/master: * morituri/common/musicbrainzngs.py: Handle multiple artists correctly.
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 a5cd47d44c9c31a74c917f35156a446294e2edba
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Apr 1 20:42:46 2012 +0000
* morituri/common/musicbrainzngs.py:
Handle multiple artists correctly.
diff --git a/ChangeLog b/ChangeLog
index 7be3d48..62eee70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-04-01 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/common/musicbrainzngs.py:
+ Handle multiple artists correctly.
+
+2012-04-01 Thomas Vander Stichele <thomas at apestaart dot org>
+
patch by: Christophe Fergeau <cfergeau at redhat.com)
* morituri/common/program.py:
diff --git a/morituri/common/musicbrainzngs.py b/morituri/common/musicbrainzngs.py
index 783ce06..1190ce9 100644
--- a/morituri/common/musicbrainzngs.py
+++ b/morituri/common/musicbrainzngs.py
@@ -101,15 +101,19 @@ def _getMetadata(release, discid):
metadata = DiscMetadata()
- if len(release['artist-credit']) > 1:
- log.warning('musicbrainzngs', 'artist-credit more than 1: %r',
- release['artist-credit'])
-
credit = release['artist-credit']
artist = credit[0]['artist']
- albumArtistName = credit[0].get(
- 'name', credit[0]['artist'].get('name', None))
+
+ if len(credit) > 1:
+ log.debug('musicbrainzngs', 'artist-credit more than 1: %r', credit)
+
+ for i, c in enumerate(credit):
+ if isinstance(c, dict):
+ credit[i] = c.get(
+ 'name', c['artist'].get('name', None))
+
+ albumArtistName = "".join(credit)
# FIXME: is there a better way to check for VA
metadata.various = False
@@ -150,15 +154,18 @@ def _getMetadata(release, discid):
metadata.title = title
for t in medium['track-list']:
track = TrackMetadata()
- if len(t['recording']['artist-credit']) > 1:
- # FIXME: do something sensible for multiple artists
- log.warning('musicbrainzngs', 'artist-credit more than 1: %r',
- t['recording']['artist-credit'])
+ credit = t['recording']['artist-credit']
+ if len(credit) > 1:
+ log.debug('musicbrainzngs',
+ 'artist-credit more than 1: %r', credit)
+ # credit is of the form [dict, str, dict, ... ]
+ for i, c in enumerate(credit):
+ if isinstance(c, dict):
+ credit[i] = c.get(
+ 'name', c['artist'].get('name', None))
- credit = t['recording']['artist-credit']
- trackArtistName = credit[0].get(
- 'name', credit[0]['artist'].get('name', None))
+ trackArtistName = "".join(credit)
if not artist:
track.artist = metadata.artist
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list