diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index 1fcc2cebb..a1a197f41 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -52,6 +52,7 @@ class AlbumInfo(object): - ``albumdisambig``: MusicBrainz release disambiguation comment - ``artist_credit``: Release-specific artist name - ``data_source``: The original data source (MusicBrainz, Discogs, etc.) + - ``data_url``: The data source release URL. The fields up through ``tracks`` are required. The others are optional and may be None. @@ -62,7 +63,8 @@ class AlbumInfo(object): releasegroup_id=None, catalognum=None, script=None, language=None, country=None, albumstatus=None, media=None, albumdisambig=None, artist_credit=None, original_year=None, - original_month=None, original_day=None, data_source=None): + original_month=None, original_day=None, data_source=None, + data_url=None): self.album = album self.album_id = album_id self.artist = artist @@ -90,6 +92,7 @@ class AlbumInfo(object): self.original_month = original_month self.original_day = original_day self.data_source = data_source or 'Unknown' + self.data_url = data_url # Work around a bug in python-musicbrainz-ngs that causes some # strings to be bytes rather than Unicode. diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 21ae2080d..588b7675b 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -216,6 +216,10 @@ def show_change(cur_artist, cur_album, match): message += u' %s' % ui.colorize('yellow', PARTIAL_MATCH_MESSAGE) print_(message) + # Data URL. + if match.info.data_url: + print_('URL:\n %s' % match.info.data_url) + # Info line. info = [] info.append('(Similarity: %s)' % dist_string(match.distance)) diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 66831ca85..0f2ababf2 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -91,6 +91,7 @@ class DiscogsPlugin(BeetsPlugin): catalogno = None country = result.data.get('country') media = result.data['formats'][0]['name'] + data_url = result.data['uri'] return AlbumInfo(album, album_id, artist, artist_id, tracks, asin=None, albumtype=albumtype, va=va, year=year, month=None, day=None, label=label, mediums=mediums, @@ -99,7 +100,8 @@ class DiscogsPlugin(BeetsPlugin): country=country, albumstatus=None, media=media, albumdisambig=None, artist_credit=None, original_year=None, original_month=None, - original_day=None, data_source='Discogs') + original_day=None, data_source='Discogs', + data_url=data_url) def get_artist(self, artists): """Returns an artist string (all artists) and an artist_id (the main