mirror of
https://github.com/beetbox/beets.git
synced 2026-01-13 03:34:31 +01:00
include label name in album info dict
This commit is contained in:
parent
3a2e99148d
commit
5af3ec9e1c
1 changed files with 17 additions and 8 deletions
|
|
@ -222,20 +222,28 @@ def release_dict(release, tracks=None):
|
|||
out['albumtype'] = releasetype.split('#')[1].lower()
|
||||
break
|
||||
|
||||
# Release date.
|
||||
# Release date and label.
|
||||
try:
|
||||
date_str = release.getEarliestReleaseDate()
|
||||
event = release.getEarliestReleaseEvent()
|
||||
except:
|
||||
# The python-musicbrainz2 module has a bug that will raise an
|
||||
# exception when there is no release date to be found. In this
|
||||
# case, we just skip adding a release date to the dict.
|
||||
pass
|
||||
else:
|
||||
if date_str:
|
||||
date_parts = date_str.split('-')
|
||||
for key in ('year', 'month', 'day'):
|
||||
if date_parts:
|
||||
out[key] = int(date_parts.pop(0))
|
||||
if event:
|
||||
# Release date.
|
||||
date_str = event.getDate()
|
||||
if date_str:
|
||||
date_parts = date_str.split('-')
|
||||
for key in ('year', 'month', 'day'):
|
||||
if date_parts:
|
||||
out[key] = int(date_parts.pop(0))
|
||||
|
||||
# Label name.
|
||||
label = event.getLabel()
|
||||
if label:
|
||||
out['label'] = label.getName()
|
||||
|
||||
# Tracks.
|
||||
if tracks is not None:
|
||||
|
|
@ -278,7 +286,8 @@ def album_for_id(albumid):
|
|||
information dictionary. If no match is found, returns None.
|
||||
"""
|
||||
query = mbws.Query()
|
||||
inc = mbws.ReleaseIncludes(artist=True, tracks=True, releaseEvents=True)
|
||||
inc = mbws.ReleaseIncludes(artist=True, tracks=True, releaseEvents=True,
|
||||
labels=True)
|
||||
try:
|
||||
album = _query_wrap(query.getReleaseById, albumid, inc)
|
||||
except (mbws.ResourceNotFoundError, mbws.RequestError), exc:
|
||||
|
|
|
|||
Loading…
Reference in a new issue