mirror of
https://github.com/beetbox/beets.git
synced 2026-02-27 09:41:51 +01:00
add work, work-disambig and work_id tags
This commit is contained in:
parent
d77a13eb34
commit
b193f250ba
2 changed files with 22 additions and 1 deletions
|
|
@ -159,6 +159,9 @@ class TrackInfo(object):
|
|||
- ``composer_sort``: individual track composer sort name
|
||||
- ``arranger`: individual track arranger name
|
||||
- ``track_alt``: alternative track number (tape, vinyl, etc.)
|
||||
- ``work`: individual track work title
|
||||
- ``work_id`: individual track work id
|
||||
- ``work_disambig`: individual track work diambiguation
|
||||
|
||||
Only ``title`` and ``track_id`` are required. The rest of the fields
|
||||
may be None. The indices ``index``, ``medium``, and ``medium_index``
|
||||
|
|
@ -169,7 +172,8 @@ class TrackInfo(object):
|
|||
medium_index=None, medium_total=None, artist_sort=None,
|
||||
disctitle=None, artist_credit=None, data_source=None,
|
||||
data_url=None, media=None, lyricist=None, composer=None,
|
||||
composer_sort=None, arranger=None, track_alt=None):
|
||||
composer_sort=None, arranger=None, track_alt=None,
|
||||
work=None, work_id=None, work_disambig=None):
|
||||
self.title = title
|
||||
self.track_id = track_id
|
||||
self.release_track_id = release_track_id
|
||||
|
|
@ -191,6 +195,9 @@ class TrackInfo(object):
|
|||
self.composer_sort = composer_sort
|
||||
self.arranger = arranger
|
||||
self.track_alt = track_alt
|
||||
self.work = work
|
||||
self.work_id = work_id
|
||||
self.work_disambig = work_disambig
|
||||
|
||||
# As above, work around a bug in python-musicbrainz-ngs.
|
||||
def decode(self, codec='utf-8'):
|
||||
|
|
|
|||
|
|
@ -210,9 +210,18 @@ def track_info(recording, index=None, medium=None, medium_index=None,
|
|||
lyricist = []
|
||||
composer = []
|
||||
composer_sort = []
|
||||
work = []
|
||||
work_id = []
|
||||
work_disambig = []
|
||||
for work_relation in recording.get('work-relation-list', ()):
|
||||
if work_relation['type'] != 'performance':
|
||||
continue
|
||||
work.append(work_relation['work']['title'])
|
||||
work_id.append(work_relation['work']['id'])
|
||||
if 'disambiguation' in work_relation['work']:
|
||||
work_disambig.append(work_relation['work']['disambiguation'])
|
||||
else:
|
||||
work_disambig.append('')
|
||||
for artist_relation in work_relation['work'].get(
|
||||
'artist-relation-list', ()):
|
||||
if 'type' in artist_relation:
|
||||
|
|
@ -237,6 +246,11 @@ def track_info(recording, index=None, medium=None, medium_index=None,
|
|||
arranger.append(artist_relation['artist']['name'])
|
||||
if arranger:
|
||||
info.arranger = u', '.join(arranger)
|
||||
if work:
|
||||
info.work = u', '.join(work)
|
||||
info.work_id = u', '.join(work_id)
|
||||
if all(dis for dis in work_disambig):
|
||||
info.work_disambig = u', '.join(work_disambig)
|
||||
|
||||
info.decode()
|
||||
return info
|
||||
|
|
|
|||
Loading…
Reference in a new issue