This commit is contained in:
Lukas Schulz 2020-12-19 23:24:11 +01:00
parent 6331b402a2
commit c1b0447df6

14
main.py
View file

@ -9,8 +9,8 @@ import threading
import requests import requests
from io import BytesIO from io import BytesIO
import time import time
#import urllib.request
import requests import requests
import shutil
@ -42,13 +42,10 @@ def get_track():
track = sp.currently_playing() track = sp.currently_playing()
print(track['is_playing']) print(track['is_playing'])
print(track['item']['name'] + ' - ' + track['item']['artists'][0]['name']) print(track['item']['name'] + ' - ' + track['item']['artists'][0]['name'])
#print('getting image') print('getting image')
#urlretrieve(track['item']['album']['images'][0]['url'], 'thumbnail.jpg') urlretrieve(track['item']['album']['images'][0]['url'], 'thumbnail.jpg')
#imageString = requests.get(track['item']['album']['images'][0]['url']) #imageString = requests.get(track['item']['album']['images'][0]['url'])
image_url=track['item']['album']['images'][0]['url'] image = Image.open('thumbnail.jpg')
print('downloading and opening image')
image = Image.open(requests.get(image_url, stream=True).raw)
#image = Image.open('thumbnail.jpg')
print('resizing image') print('resizing image')
image = image.resize((32,32)) image = image.resize((32,32))
#return image #return image
@ -75,8 +72,7 @@ def main():
#if __name__ == "__main__": if __name__ == "__main__":
print('started')
main() main()
print('text') print('text')
while True: while True: