Allow handling of None

This commit is contained in:
Alok Saboo 2023-12-20 10:13:09 -05:00
parent 6d44c6af00
commit 272c7c32bc
2 changed files with 3 additions and 4 deletions

View file

@ -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()

View file

@ -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):