Added parsing of secondary album types. Fixes #2200

This commit is contained in:
anshuman73 2016-11-29 01:53:59 +05:30
parent 430369062b
commit 318661b4a9

View file

@ -276,11 +276,18 @@ def album_info(release):
disambig.append(release.get('disambiguation'))
info.albumdisambig = u', '.join(disambig)
# Release type not always populated.
if 'type' in release['release-group']:
reltype = release['release-group']['type']
if reltype:
info.albumtype = reltype.lower()
# Considers all release types (both primary and secondary) and stores as a comma-separated string
all_types = []
if 'primary-type' in release['release-group']:
rel_primarytype = release['release-group']['primary-type']
if rel_primarytype:
all_types.append(rel_primarytype.lower())
if 'secondary-type-list' in release['release-group']:
for secondarytype in release['release-group']['secondary-type-list']:
all_types.append(secondarytype.lower())
if len(all_types) != 0:
all_types = ','.join(all_types)
info.albumtype = all_types.lower()
# Release dates.
release_date = release.get('date')