mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 00:44:00 +01:00
Fix for '''TypeError: cannot concatenate 'str' and 'NoneType' obejects'''... when trying to scan music library. Basically just cut down the dictionary when searching for an artist with a limit=1 to return only the artistid as that was the only variable we were using
This commit is contained in:
+16
-14
@@ -92,16 +92,17 @@ def findArtist(name, limit=1):
|
|||||||
else:
|
else:
|
||||||
uniquename = unicode(result['sort-name'])
|
uniquename = unicode(result['sort-name'])
|
||||||
if result['name'] != uniquename and limit == 1:
|
if result['name'] != uniquename and limit == 1:
|
||||||
logger.debug('Found an artist with a disambiguation: %s - doing an album based search' % name)
|
logger.info('Found an artist with a disambiguation: %s - doing an album based search' % name)
|
||||||
artistdict = findArtistbyAlbum(name)
|
artistdict = findArtistbyAlbum(name)
|
||||||
if not artistdict:
|
if not artistdict:
|
||||||
logger.debug('Cannot determine the best match from an artist/album search. Using top match instead')
|
logger.info('Cannot determine the best match from an artist/album search. Using top match instead')
|
||||||
artistlist.append({
|
artistlist.append({
|
||||||
'name': unicode(result['sort-name']),
|
# Just need the artist id if the limit is 1
|
||||||
'uniquename': uniquename,
|
# 'name': unicode(result['sort-name']),
|
||||||
|
# 'uniquename': uniquename,
|
||||||
'id': unicode(result['id']),
|
'id': unicode(result['id']),
|
||||||
'url': unicode("http://musicbrainz.org/artist/" + result['id']),#probably needs to be changed
|
# 'url': unicode("http://musicbrainz.org/artist/" + result['id']),#probably needs to be changed
|
||||||
'score': int(result['ext:score'])
|
# 'score': int(result['ext:score'])
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
artistlist.append(artistdict)
|
artistlist.append(artistdict)
|
||||||
@@ -467,15 +468,16 @@ def findArtistbyAlbum(name):
|
|||||||
artist_dict = {}
|
artist_dict = {}
|
||||||
for releaseGroup in results:
|
for releaseGroup in results:
|
||||||
newArtist = releaseGroup['artist-credit'][0]['artist']
|
newArtist = releaseGroup['artist-credit'][0]['artist']
|
||||||
if 'disambiguation' in newArtist:
|
# Only need the artist ID if we're doing an artist+album lookup
|
||||||
uniquename = unicode(newArtist['sort-name'] + " (" + newArtist['disambiguation'] + ")")
|
#if 'disambiguation' in newArtist:
|
||||||
else:
|
# uniquename = unicode(newArtist['sort-name'] + " (" + newArtist['disambiguation'] + ")")
|
||||||
uniquename = unicode(newArtist['sort-name'])
|
#else:
|
||||||
artist_dict['name'] = unicode(newArtist['sort-name'])
|
# uniquename = unicode(newArtist['sort-name'])
|
||||||
artist_dict['uniquename'] = uniquename
|
#artist_dict['name'] = unicode(newArtist['sort-name'])
|
||||||
|
#artist_dict['uniquename'] = uniquename
|
||||||
artist_dict['id'] = unicode(newArtist['id'])
|
artist_dict['id'] = unicode(newArtist['id'])
|
||||||
artist_dict['url'] = u'http://musicbrainz.org/artist/' + newArtist['id']
|
#artist_dict['url'] = u'http://musicbrainz.org/artist/' + newArtist['id']
|
||||||
artist_dict['score'] = int(releaseGroup['ext:score'])
|
#artist_dict['score'] = int(releaseGroup['ext:score'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user