ripper: Fix UnboundLocalError if no album art found

The `Ripper.fetch_album_art` method should return immediately if no
album art is found for a release.

Fixes #1
feature/metadata-optional
Dustin 2024-01-14 14:38:03 -06:00
parent 83fbe26e92
commit 9049963e20
1 changed files with 3 additions and 0 deletions

View File

@ -352,10 +352,13 @@ class Ripper:
self._status_queue.put((None, (message, is_err))) self._status_queue.put((None, (message, is_err)))
def fetch_album_art(self) -> None: def fetch_album_art(self) -> None:
assert self.release
assert Image
try: try:
data = fetch_album_art(self.release) data = fetch_album_art(self.release)
except AlbumArtNotFound: except AlbumArtNotFound:
log.error('No album art found for %s', self.release.title) log.error('No album art found for %s', self.release.title)
return
buf = io.BytesIO(data) buf = io.BytesIO(data)
img = Image.open(buf) img = Image.open(buf)
img.thumbnail((1000, 1000)) img.thumbnail((1000, 1000))