From 272c7c32bc0f86915f039fb76cec9cf0fa1b8cdd Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Wed, 20 Dec 2023 10:13:09 -0500 Subject: [PATCH] Allow handling of None --- beetsplug/lastimport.py | 6 +++--- beetsplug/listenbrainz.py | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/beetsplug/lastimport.py b/beetsplug/lastimport.py index 12a98764a..42e154d88 100644 --- a/beetsplug/lastimport.py +++ b/beetsplug/lastimport.py @@ -204,9 +204,9 @@ def process_tracks(lib, tracks, log): for num in range(0, total): song = None - trackid = tracks[num]["mbid"].strip() - artist = tracks[num]["artist"].get("name", "").strip() - title = tracks[num]["name"].strip() + trackid = tracks[num]["mbid"].strip() or None + artist = tracks[num]["artist"].get("name", "").strip() or None + title = tracks[num]["name"].strip() or None album = "" if "album" in tracks[num]: album = tracks[num]["album"].get("name", "").strip() diff --git a/beetsplug/listenbrainz.py b/beetsplug/listenbrainz.py index fe2e9216f..a7f93c239 100644 --- a/beetsplug/listenbrainz.py +++ b/beetsplug/listenbrainz.py @@ -145,7 +145,6 @@ class ListenBrainzPlugin(BeetsPlugin): if resp.get("recording-count") == "1": return resp.get("recording-list")[0].get("id") else: - self._log.debug(f"Invalid Search Error: {resp}") return None def get_playlists_createdfor(self, username):