AlbumCover is now displayed

This commit is contained in:
2023-12-30 11:39:34 +01:00
parent b82b95a911
commit 360ea58a7c
3 changed files with 5 additions and 6 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 132 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 43 KiB

+5 -6
View File
@@ -26,15 +26,10 @@ class RadioParadise(object):
result=(f'Titel: {self.title}\nArtiest: {self.artist}\nAlbum: {self.album}\nJaar: {self.year}\nTijd: {self.time}') result=(f'Titel: {self.title}\nArtiest: {self.artist}\nAlbum: {self.album}\nJaar: {self.year}\nTijd: {self.time}')
return result return result
class AlbumCover(RadioParadise):
def __init__(self, path, *args, **kwargs):
super().__init__(*args, **kwargs)
self.jpg_path=path
def store_albumcover(self): def store_albumcover(self):
rp_raw_image=requests.get(self.jpg_path).content rp_raw_image=requests.get(self.jpg_path).content
rp_file=open("album_art.jpg", "wb") rp_file=open("album_art.jpg", "wb")
rp_file.write("rp_raw_image") rp_file.write(rp_raw_image)
rp_file.close() rp_file.close()
rp_convert_img=Image.open("album_art.jpg") rp_convert_img=Image.open("album_art.jpg")
rp_convert_img.save("album_art.gif") rp_convert_img.save("album_art.gif")
@@ -59,6 +54,10 @@ class RPViewer(Tk):
self.textbox.insert("1.0", self.rp.get_fmt_list()) self.textbox.insert("1.0", self.rp.get_fmt_list())
self.textbox.config(state=DISABLED) self.textbox.config(state=DISABLED)
self.textbox.pack() self.textbox.pack()
self.rp.store_albumcover()
self.img = PhotoImage(file="album_art.gif", format='gif')
self.image_lbl = Label(self, image=self.img)
self.image_lbl.pack()
def quit(self): def quit(self):
exit() exit()