Code using OOP paradigm for more extensibility and readability
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
album_art.gif
|
album_art.gif
|
||||||
album_art.jpg
|
album_art.jpg
|
||||||
|
|
||||||
|
|||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
from tkinter import *
|
||||||
|
from tkinter.font import Font
|
||||||
|
from PIL import Image
|
||||||
|
import requests
|
||||||
|
import urllib
|
||||||
|
|
||||||
|
|
||||||
|
class RP:
|
||||||
|
def __init__(self):
|
||||||
|
self.title
|
||||||
|
self.artist
|
||||||
|
self.album
|
||||||
|
self.year
|
||||||
|
self.time
|
||||||
|
self.jpg_path
|
||||||
|
|
||||||
|
def rp_refresh_API():
|
||||||
|
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"]
|
||||||
|
|
||||||
|
def store_albumcover():
|
||||||
|
rp_raw_image=requests.get(jpg_path).content
|
||||||
|
rp_file.open("album_art.jpg", "wb")
|
||||||
|
rp_file.close()
|
||||||
|
rp_convert_img=Image.open("album_art.jpg")
|
||||||
|
rp_convert_img.save("album_art.gif")
|
||||||
|
rp_convert_img.close()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
if __name__=="__main__":
|
||||||
|
main()
|
||||||
|
|
||||||
Reference in New Issue
Block a user