Merge pull request 'dev' (#1) from dev into master
Reviewed-on: http://gitea.fritz.box:3000/sulzlep/get_rp/pulls/1
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -3,6 +3,8 @@
|
|||||||
from tkinter import *
|
from tkinter import *
|
||||||
from tkinter.font import Font
|
from tkinter.font import Font
|
||||||
import requests
|
import requests
|
||||||
|
import urllib
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
def get_rp():
|
def get_rp():
|
||||||
# Get API respons
|
# Get API respons
|
||||||
@@ -15,18 +17,32 @@ def get_rp():
|
|||||||
album = tekst["album"]
|
album = tekst["album"]
|
||||||
year = tekst["year"]
|
year = tekst["year"]
|
||||||
time = tekst["time"]
|
time = tekst["time"]
|
||||||
# path = tekst["cover_med"]
|
jpg_path = tekst["cover"]
|
||||||
|
|
||||||
# Return caller standard information
|
# Return caller standard information
|
||||||
message = (f'Titel: {title}\nArtiest: {artist}\nAlbum: {album}\nJaar: {year}\nTijd: {time}')
|
message = (f'Titel: {title}\nArtiest: {artist}\nAlbum: {album}\nJaar: {year}\nTijd: {time}')
|
||||||
return (message)
|
return message,jpg_path
|
||||||
|
|
||||||
def rp_quit():
|
def rp_quit():
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
def rp_refresh():
|
def rp_refresh():
|
||||||
rp_tekstbox.delete("1.0", "end")
|
rp_tekstbox.delete("1.0", "end")
|
||||||
rp_tekstbox.insert("1.0", get_rp())
|
rp_tekstbox.insert("1.0", get_rp()[0])
|
||||||
|
|
||||||
|
rp_image_path = get_rp()[1]
|
||||||
|
rp_image_file = requests.get(rp_image_path).content
|
||||||
|
|
||||||
|
rp_file=open("album_art.jpg", 'wb')
|
||||||
|
rp_file.write(rp_image_file)
|
||||||
|
rp_file.close()
|
||||||
|
rp_image = Image.open("album_art.jpg")
|
||||||
|
rp_image.save("album_art.gif")
|
||||||
|
rp_image.close()
|
||||||
|
|
||||||
|
img = PhotoImage(file="album_art.gif", format='gif')
|
||||||
|
image_lbl.configure(image=img)
|
||||||
|
image_lbl.image=img
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
|
|
||||||
@@ -42,7 +58,21 @@ if __name__=="__main__":
|
|||||||
button_quit.pack(side=BOTTOM)
|
button_quit.pack(side=BOTTOM)
|
||||||
button_refresh.pack(side=TOP)
|
button_refresh.pack(side=TOP)
|
||||||
|
|
||||||
rp_tekstbox.insert("1.0", get_rp())
|
rp_tekstbox.insert("1.0", get_rp()[0])
|
||||||
rp_tekstbox.pack()
|
rp_tekstbox.pack()
|
||||||
|
|
||||||
|
rp_image_path = get_rp()[1]
|
||||||
|
rp_image_file = requests.get(rp_image_path).content
|
||||||
|
|
||||||
|
rp_file=open("album_art.jpg", 'wb')
|
||||||
|
rp_file.write(rp_image_file)
|
||||||
|
rp_file.close()
|
||||||
|
rp_image = Image.open("album_art.jpg")
|
||||||
|
rp_image.save("album_art.gif")
|
||||||
|
rp_image.close()
|
||||||
|
|
||||||
|
img = PhotoImage(file="album_art.gif", format='gif')
|
||||||
|
image_lbl = Label(window, image=img)
|
||||||
|
image_lbl.pack()
|
||||||
|
|
||||||
window.mainloop()
|
window.mainloop()
|
||||||
Reference in New Issue
Block a user