From d7ad9584fb54d2d13553bffccadc36093a7e830a Mon Sep 17 00:00:00 2001 From: Lukas Schulz Date: Sat, 19 Dec 2020 22:50:24 +0100 Subject: [PATCH] yes. --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 660dbf6..337db98 100644 --- a/main.py +++ b/main.py @@ -39,14 +39,16 @@ def get_track(): print(track['is_playing']) print(track['item']['name'] + ' - ' + track['item']['artists'][0]['name']) print('getting image') - imageString = requests.get(track['item']['album']['images'][0]['url']) - image = Image.open(BytesIO(imageString.content)) + with urllib.request.urlopen(track['item']['album']['images'][0]['url']) as url: + f = io.BytesIO(url.read()) + #imageString = requests.get(track['item']['album']['images'][0]['url']) + image = Image.open(f) print('resizing image') image = image.resize((32,32)) #return image #image.save("thumbnail.jpg","JPEG") print('set image') - screen.SetImage(thumbnail.convert('RGB')) + screen.SetImage(image.convert('RGB')) print('image set') #if token: