From 0430bd383adb8ec0ef4c61e922ac3a3d8176350e Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 24 Jul 2025 20:47:01 -0400 Subject: [PATCH] discogs: don't crash if a release is deleted --- beetsplug/discogs.py | 9 ++++++++- docs/changelog.rst | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 9765f317f..ac7421c5f 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -305,7 +305,14 @@ class DiscogsPlugin(MetadataSourcePlugin): # Explicitly reload the `Release` fields, as they might not be yet # present if the result is from a `discogs_client.search()`. if not result.data.get("artists"): - result.refresh() + try: + result.refresh() + except CONNECTION_ERRORS: + self._log.debug( + "Connection error in release lookup: {0}", + result, + ) + return None # Sanity check for required fields. The list of required fields is # defined at Guideline 1.3.1.a, but in practice some releases might be diff --git a/docs/changelog.rst b/docs/changelog.rst index 23672f2bd..c0e96635f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -55,6 +55,8 @@ Bug fixes: e.g. non latin characters as 盗作. If you want to keep the legacy behavior set the config option ``spotify.search_query_ascii: yes``. :bug:`5699` +* :doc:`plugins/discogs`: Beets will no longer crash if a release has been + deleted, and returns a 404. For packagers: