Working result so far. Still needs a lot of work on Threading
This commit is contained in:
Regular → Executable
+38
-19
@@ -7,36 +7,55 @@ import requests
|
|||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
|
||||||
class RP:
|
class RadioParadise(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.title
|
self.title=None
|
||||||
self.artist
|
self.artist=None
|
||||||
self.album
|
self.album=None
|
||||||
self.year
|
self.year=None
|
||||||
self.time
|
self.time=None
|
||||||
self.jpg_path
|
self.jpg_path=None
|
||||||
|
|
||||||
def rp_refresh_API():
|
def rp_reload_api(self):
|
||||||
respons=requests.get("https://api.radioparadise.com/api/now_playing")
|
respons=requests.get("https://api.radioparadise.com/api/now_playing")
|
||||||
rp_dict=respons.json()
|
rp_dict=respons.json()
|
||||||
title=rp_dict["title"]
|
self.title=rp_dict["title"]
|
||||||
artist=rp_dict["artist"]
|
self.artist=rp_dict["artist"]
|
||||||
albun=rp_dict["album"]
|
self.album=rp_dict["album"]
|
||||||
year=rp_dict["year"]
|
self.year=rp_dict["year"]
|
||||||
time=rp_dict["time"]
|
self.time=rp_dict["time"]
|
||||||
jpg_path=rp_dict["cover"]
|
self.jpg_path=rp_dict["cover"]
|
||||||
|
|
||||||
def store_albumcover():
|
class AlbumCover(RadioParadise):
|
||||||
rp_raw_image=requests.get(jpg_path).content
|
def __init__(self, path):
|
||||||
rp_file.open("album_art.jpg", "wb")
|
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_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")
|
||||||
rp_convert_img.close()
|
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():
|
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__":
|
if __name__=="__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user