From e35c767e2c935b392e7ca70419fe2c1861a7fa76 Mon Sep 17 00:00:00 2001 From: J0J0 T Date: Sun, 9 Jan 2022 14:29:47 +0100 Subject: [PATCH 1/3] Skip Discogs query on insufficiently tagged files - When files are missing both, album and artist tags, the Discogs metadata plugin sends empty information to the Discogs API which returns arbitrary query results. - This patch catches this case and states it in beets import verbose output. --- beetsplug/discogs.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index d015e4201..8c950c521 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -157,6 +157,11 @@ class DiscogsPlugin(BeetsPlugin): if not self.discogs_client: return + if not album and not artist: + self._log.debug('Skipping Discogs query. Files missing album and ' + 'artist tags.') + return [] + if va_likely: query = album else: From 4401de94f7b70d55867b1cfed24ebbfa330e6fa9 Mon Sep 17 00:00:00 2001 From: J0J0 T Date: Mon, 10 Jan 2022 08:20:46 +0100 Subject: [PATCH 2/3] Add changelog entry for PR #4227 (discogs: Skip Discogs query on insufficiently tagged files). --- docs/changelog.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index d13dcdd4a..88d465d7d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -22,7 +22,7 @@ Bug fixes: * :doc:`/plugins/unimported`: The new ``ignore_subdirectories`` configuration option added in 1.6.0 now has a default value if it hasn't been set. * :doc:`/plugins/deezer`: Tolerate missing fields when searching for singleton - tracks + tracks. :bug:`4116` * :doc:`/plugins/replaygain`: The type of the internal ``r128_track_gain`` and ``r128_album_gain`` fields was changed from integer to float to fix loss of @@ -35,6 +35,9 @@ Bug fixes: * :doc:`plugins/web`: Fix handling of "query" requests. Previously queries consisting of more than one token (separated by a slash) always returned an empty result. +* :doc:`/plugins/discogs`: Skip Discogs query on insufficiently tagged files + (artist and album tags missing) to prevent arbitrary candidate results. + :bug:`4227` For packagers: From 2a53b890be70b6cf537e045c3a6ccbbb96b67f31 Mon Sep 17 00:00:00 2001 From: J0J0 T Date: Mon, 10 Jan 2022 09:10:19 +0100 Subject: [PATCH 3/3] Add to discogs plugin docs regarding PR #4227 - Clarify basic search behaviour in intro chapter of discogs plugin, - and state change introduced in PR#4227 (discogs: Discogs query on insufficiently tagged files) --- docs/plugins/discogs.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/plugins/discogs.rst b/docs/plugins/discogs.rst index 40875b022..5aea1ae6b 100644 --- a/docs/plugins/discogs.rst +++ b/docs/plugins/discogs.rst @@ -19,7 +19,8 @@ authentication credentials via a personal access token or an OAuth2 authorization. Matches from Discogs will now show up during import alongside matches from -MusicBrainz. +MusicBrainz. The search terms sent to the Discogs API are based on the artist +and album tags of your tracks. If those are empty no query will be issued. If you have a Discogs ID for an album you want to tag, you can also enter it at the "enter Id" prompt in the importer.