Working result so far. Still needs a lot of work on Threading
This commit is contained in:
Regular → Executable
+37
-18
@@ -7,36 +7,55 @@ import requests
|
||||
import urllib
|
||||
|
||||
|
||||
class RP:
|
||||
class RadioParadise(object):
|
||||
def __init__(self):
|
||||
self.title
|
||||
self.artist
|
||||
self.album
|
||||
self.year
|
||||
self.time
|
||||
self.jpg_path
|
||||
self.title=None
|
||||
self.artist=None
|
||||
self.album=None
|
||||
self.year=None
|
||||
self.time=None
|
||||
self.jpg_path=None
|
||||
|
||||
def rp_refresh_API():
|
||||
def rp_reload_api(self):
|
||||
respons=requests.get("https://api.radioparadise.com/api/now_playing")
|
||||
rp_dict=respons.json()
|
||||
title=rp_dict["title"]
|
||||
artist=rp_dict["artist"]
|
||||
albun=rp_dict["album"]
|
||||
year=rp_dict["year"]
|
||||
time=rp_dict["time"]
|
||||
jpg_path=rp_dict["cover"]
|
||||
self.title=rp_dict["title"]
|
||||
self.artist=rp_dict["artist"]
|
||||
self.album=rp_dict["album"]
|
||||
self.year=rp_dict["year"]
|
||||
self.time=rp_dict["time"]
|
||||
self.jpg_path=rp_dict["cover"]
|
||||
|
||||
def store_albumcover():
|
||||
rp_raw_image=requests.get(jpg_path).content
|
||||
rp_file.open("album_art.jpg", "wb")
|
||||
class AlbumCover(RadioParadise):
|
||||
def __init__(self, path):
|
||||
self.jpg_path=path
|
||||
|
||||
def store_albumcover(self):
|
||||
rp_raw_image=requests.get(self.jpg_path).content
|
||||
rp_file=open("album_art.jpg", "wb")
|
||||
rp_file.write("rp_raw_image")
|
||||
rp_file.close()
|
||||
rp_convert_img=Image.open("album_art.jpg")
|
||||
rp_convert_img.save("album_art.gif")
|
||||
rp_convert_img.close()
|
||||
|
||||
|
||||
class RPViewer(Tk):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.title("Radio Paradise Viewer")
|
||||
self.geometry("500x740")
|
||||
self.resizable(False,False)
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
rp_play=RadioParadise()
|
||||
rp_play.rp_reload_api()
|
||||
print (rp_play.title)
|
||||
print(rp_play.artist)
|
||||
print (rp_play.time)
|
||||
app=RPViewer()
|
||||
app.mainloop()
|
||||
|
||||
if __name__=="__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user