artist name can but None

This commit is contained in:
Edward Betts 2019-09-30 19:53:36 +01:00
parent bb6096927b
commit c096a8fa6e

View file

@ -81,8 +81,9 @@ def build_browse_item_map(bindings):
item = { item = {
'image_filename': image_filename, 'image_filename': image_filename,
'date': d, 'date': d,
'artist_name': artist_name,
} }
if artist_name:
item['artist_name'] = artist_name
if label != row_qid: if label != row_qid:
item['label'] = label item['label'] = label
@ -104,8 +105,9 @@ def build_browse_item_map(bindings):
lang, title = item['title'] lang, title = item['title']
titles[lang] = title titles[lang] = title
filenames.add(item['image_filename']) filenames.add(item['image_filename'])
if item['artist_name'] not in artist_names: artist_name = item.get('artist_name')
artist_names.append(item['artist_name']) if artist_name and artist_name not in artist_names:
artist_names.append(artist_name)
if 'label' in item: if 'label' in item:
labels.add(item['label']) labels.add(item['label'])
@ -115,6 +117,8 @@ def build_browse_item_map(bindings):
'image_filename': list(filenames), 'image_filename': list(filenames),
'artist_name': ', '.join(artist_names), 'artist_name': ', '.join(artist_names),
} }
if artist_names:
item['artist_name'] = ', '.join(artist_names)
if labels: if labels:
assert len(labels) == 1 assert len(labels) == 1
item['label'] = list(labels)[0] item['label'] = list(labels)[0]