From 70a4d0462dea54b6dd59affd8c65489be795ead8 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Wed, 1 Oct 2025 17:15:13 -0400 Subject: [PATCH] Persist spotify track attributes even if audio features are missing --- beetsplug/spotify.py | 11 +++++------ docs/changelog.rst | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 0f6e0012b..f78041094 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -694,14 +694,13 @@ class SpotifyPlugin( audio_features = self.track_audio_features(spotify_track_id) if audio_features is None: self._log.info("No audio features found for: {}", item) - continue - for feature in audio_features.keys(): - if feature in self.spotify_audio_features.keys(): - item[self.spotify_audio_features[feature]] = audio_features[ - feature - ] + else: + for feature, value in audio_features.items(): + if feature in self.spotify_audio_features: + item[self.spotify_audio_features[feature]] = value item["spotify_updated"] = time.time() item.store() + self._log.debug("Stored spotify_track_popularity={} for {} (item id {})", item.get("spotify_track_popularity"), item.get("title"), item.id) if write: item.try_write() diff --git a/docs/changelog.rst b/docs/changelog.rst index a39b3db63..8c799783f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -19,6 +19,9 @@ New features: Bug fixes: +- :doc:`plugins/spotify` Ensure ``spotifysync`` keeps popularity, ISRC, + and related fields current even when audio features requests fail. + :bug:`6061` - :doc:`plugins/spotify` Fixed an issue where track matching and lookups could return incorrect or misleading results when using the Spotify plugin. The problem occurred primarily when no album was provided or when the album field