mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 10:05:13 +01:00
Merge pull request #3413 from msil/beets_tag
Add `discogs_labelid` and `discogs_artistid` fields
This commit is contained in:
commit
1b187fbf53
5 changed files with 21 additions and 4 deletions
|
|
@ -170,6 +170,8 @@ def apply_metadata(album_info, mapping):
|
|||
'style',
|
||||
'genre',
|
||||
'discogs_albumid',
|
||||
'discogs_artistid',
|
||||
'discogs_labelid',
|
||||
'albumstatus',
|
||||
'albumdisambig',
|
||||
'releasegroupdisambig',
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ class AlbumInfo(object):
|
|||
releasegroupdisambig=None, artist_credit=None,
|
||||
original_year=None, original_month=None,
|
||||
original_day=None, data_source=None, data_url=None,
|
||||
discogs_albumid=None):
|
||||
discogs_albumid=None, discogs_labelid=None,
|
||||
discogs_artistid=None):
|
||||
self.album = album
|
||||
self.album_id = album_id
|
||||
self.artist = artist
|
||||
|
|
@ -117,6 +118,8 @@ class AlbumInfo(object):
|
|||
self.data_source = data_source
|
||||
self.data_url = data_url
|
||||
self.discogs_albumid = discogs_albumid
|
||||
self.discogs_labelid = discogs_labelid
|
||||
self.discogs_artistid = discogs_artistid
|
||||
|
||||
# Work around a bug in python-musicbrainz-ngs that causes some
|
||||
# strings to be bytes rather than Unicode.
|
||||
|
|
@ -129,7 +132,8 @@ class AlbumInfo(object):
|
|||
'catalognum', 'script', 'language', 'country', 'style',
|
||||
'genre', 'albumstatus', 'albumdisambig',
|
||||
'releasegroupdisambig', 'artist_credit',
|
||||
'media', 'discogs_albumid']:
|
||||
'media', 'discogs_albumid', 'discogs_labelid',
|
||||
'discogs_artistid']:
|
||||
value = getattr(self, fld)
|
||||
if isinstance(value, bytes):
|
||||
setattr(self, fld, value.decode(codec, 'ignore'))
|
||||
|
|
|
|||
|
|
@ -450,6 +450,8 @@ class Item(LibModel):
|
|||
'genre': types.STRING,
|
||||
'style': types.STRING,
|
||||
'discogs_albumid': types.INTEGER,
|
||||
'discogs_artistid': types.INTEGER,
|
||||
'discogs_labelid': types.INTEGER,
|
||||
'lyricist': types.STRING,
|
||||
'composer': types.STRING,
|
||||
'composer_sort': types.STRING,
|
||||
|
|
@ -934,6 +936,8 @@ class Album(LibModel):
|
|||
'genre': types.STRING,
|
||||
'style': types.STRING,
|
||||
'discogs_albumid': types.INTEGER,
|
||||
'discogs_artistid': types.INTEGER,
|
||||
'discogs_labelid': types.INTEGER,
|
||||
'year': types.PaddedInt(4),
|
||||
'month': types.PaddedInt(2),
|
||||
'day': types.PaddedInt(2),
|
||||
|
|
@ -981,6 +985,8 @@ class Album(LibModel):
|
|||
'genre',
|
||||
'style',
|
||||
'discogs_albumid',
|
||||
'discogs_artistid',
|
||||
'discogs_labelid',
|
||||
'year',
|
||||
'month',
|
||||
'day',
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
|
||||
# Extract information for the optional AlbumInfo fields that are
|
||||
# contained on nested discogs fields.
|
||||
albumtype = media = label = catalogno = None
|
||||
albumtype = media = label = catalogno = labelid = None
|
||||
if result.data.get('formats'):
|
||||
albumtype = ', '.join(
|
||||
result.data['formats'][0].get('descriptions', [])) or None
|
||||
|
|
@ -333,6 +333,7 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
if result.data.get('labels'):
|
||||
label = result.data['labels'][0].get('name')
|
||||
catalogno = result.data['labels'][0].get('catno')
|
||||
labelid = result.data['labels'][0].get('id')
|
||||
|
||||
# Additional cleanups (various artists name, catalog number, media).
|
||||
if va:
|
||||
|
|
@ -365,7 +366,8 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
original_year=original_year, original_month=None,
|
||||
original_day=None, data_source='Discogs',
|
||||
data_url=data_url,
|
||||
discogs_albumid=discogs_albumid)
|
||||
discogs_albumid=discogs_albumid,
|
||||
discogs_labelid=labelid, discogs_artistid=artist_id)
|
||||
|
||||
def format(self, classification):
|
||||
if classification:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ Changelog
|
|||
|
||||
New features:
|
||||
|
||||
* :doc:`plugins/discogs` now adds two extra fields: `discogs_labelid` and
|
||||
`discogs_artistid`
|
||||
:bug: `3413`
|
||||
* :doc:`/plugins/export`: Added new ``-f`` (``--format``) flag;
|
||||
which allows for the ability to export in json, csv and xml.
|
||||
Thanks to :user:`austinmm`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue