Skip to content

Commit

Permalink
Added parsing of secondary album types. Fixes #2200
Browse files Browse the repository at this point in the history
  • Loading branch information
anshuman73 committed Nov 28, 2016
1 parent 4303690 commit 318661b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions beets/autotag/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 318661b

Please sign in to comment.