mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 18:13:17 +01:00
fixing per review comments
This commit is contained in:
parent
dd7e932a9a
commit
0cd46dab77
5 changed files with 16 additions and 21 deletions
|
|
@ -157,8 +157,8 @@ def apply_metadata(album_info, mapping):
|
|||
'country',
|
||||
'style',
|
||||
'genre',
|
||||
'discogs_release_id',
|
||||
'released_date',
|
||||
'discogs_albumid',
|
||||
'',
|
||||
'albumstatus',
|
||||
'albumdisambig',
|
||||
'releasegroupdisambig',
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class AlbumInfo(object):
|
|||
releasegroupdisambig=None, artist_credit=None,
|
||||
original_year=None, original_month=None,
|
||||
original_day=None, data_source=None, data_url=None,
|
||||
discogs_release_id=None, released_date=None):
|
||||
discogs_albumid=None):
|
||||
self.album = album
|
||||
self.album_id = album_id
|
||||
self.artist = artist
|
||||
|
|
@ -116,8 +116,7 @@ class AlbumInfo(object):
|
|||
self.original_day = original_day
|
||||
self.data_source = data_source
|
||||
self.data_url = data_url
|
||||
self.discogs_release_id = discogs_release_id
|
||||
self.released_date = released_date
|
||||
self.discogs_albumid = discogs_albumid
|
||||
|
||||
# Work around a bug in python-musicbrainz-ngs that causes some
|
||||
# strings to be bytes rather than Unicode.
|
||||
|
|
@ -130,7 +129,7 @@ class AlbumInfo(object):
|
|||
'catalognum', 'script', 'language', 'country', 'style',
|
||||
'genre', 'albumstatus', 'albumdisambig',
|
||||
'releasegroupdisambig', 'artist_credit',
|
||||
'media', 'discogs_release_id', 'released_date']:
|
||||
'media', 'discogs_albumid']:
|
||||
value = getattr(self, fld)
|
||||
if isinstance(value, bytes):
|
||||
setattr(self, fld, value.decode(codec, 'ignore'))
|
||||
|
|
|
|||
|
|
@ -437,8 +437,7 @@ class Item(LibModel):
|
|||
'albumartist_credit': types.STRING,
|
||||
'genre': types.STRING,
|
||||
'style': types.STRING,
|
||||
'discogs_release_id': types.INTEGER,
|
||||
'released_date': types.STRING,
|
||||
'discogs_albumid': types.INTEGER,
|
||||
'lyricist': types.STRING,
|
||||
'composer': types.STRING,
|
||||
'composer_sort': types.STRING,
|
||||
|
|
@ -919,8 +918,7 @@ class Album(LibModel):
|
|||
'album': types.STRING,
|
||||
'genre': types.STRING,
|
||||
'style': types.STRING,
|
||||
'discogs_release_id': types.INTEGER,
|
||||
'released_date': types.STRING,
|
||||
'discogs_albumid': types.INTEGER,
|
||||
'year': types.PaddedInt(4),
|
||||
'month': types.PaddedInt(2),
|
||||
'day': types.PaddedInt(2),
|
||||
|
|
@ -967,8 +965,7 @@ class Album(LibModel):
|
|||
'album',
|
||||
'genre',
|
||||
'style',
|
||||
'discogs_release_id',
|
||||
'released_date',
|
||||
'discogs_albumid',
|
||||
'year',
|
||||
'month',
|
||||
'day',
|
||||
|
|
|
|||
|
|
@ -305,8 +305,7 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
data_url = result.data.get('uri')
|
||||
style = self.format(result.data.get('styles'))
|
||||
genre = self.format(result.data.get('genres'))
|
||||
discogs_release_id = self.extract_release_id(result.data.get('uri'))
|
||||
released_date = result.data.get('released')
|
||||
discogs_albumid = self.extract_release_id(result.data.get('uri'))
|
||||
|
||||
# Extract information for the optional AlbumInfo fields that are
|
||||
# contained on nested discogs fields.
|
||||
|
|
@ -350,19 +349,20 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
original_year=original_year, original_month=None,
|
||||
original_day=None, data_source='Discogs',
|
||||
data_url=data_url,
|
||||
discogs_release_id=discogs_release_id,
|
||||
released_date=released_date)
|
||||
discogs_albumid=discogs_albumid)
|
||||
|
||||
def format(self, classification):
|
||||
if classification is None:
|
||||
self._log.debug('Classification not Found')
|
||||
else:
|
||||
return self.config['separator'].as_str()\
|
||||
if classification:
|
||||
return self.config['separator'].as_str() \
|
||||
.join(sorted(classification))
|
||||
else:
|
||||
return None
|
||||
|
||||
def extract_release_id(self, uri):
|
||||
if uri:
|
||||
return uri.split("/")[-1]
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_artist(self, artists):
|
||||
"""Returns an artist string (all artists) and an artist_id (the main
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class DGAlbumInfoTest(_common.TestCase):
|
|||
'uri': 'https://www.discogs.com/release/release/13633721',
|
||||
'title': 'ALBUM TITLE',
|
||||
'year': '3001',
|
||||
'released': '2019-06-07',
|
||||
'artists': [{
|
||||
'name': 'ARTIST NAME',
|
||||
'id': 'ARTIST ID',
|
||||
|
|
|
|||
Loading…
Reference in a new issue