diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index 5d116c7f2..b0bbbbf04 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -157,8 +157,8 @@ def apply_metadata(album_info, mapping): 'country', 'style', 'genre', - 'discogs_release_id', - 'released_date', + 'discogs_albumid', + '', 'albumstatus', 'albumdisambig', 'releasegroupdisambig', diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index fa4e0d73f..b946ff7c9 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -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')) diff --git a/beets/library.py b/beets/library.py index 713ad53cd..12850f933 100644 --- a/beets/library.py +++ b/beets/library.py @@ -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', diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 4daa82fbf..92a5773f5 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -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 diff --git a/test/test_discogs.py b/test/test_discogs.py index 6b8fdb8d8..61d9d5aa1 100644 --- a/test/test_discogs.py +++ b/test/test_discogs.py @@ -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',