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

24
main.py
View file

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