Code using OOP paradigm for more extensibility and readability

This commit is contained in:
2023-12-28 14:07:11 +01:00
parent 0a8a74a61d
commit 7b23a13667
2 changed files with 44 additions and 0 deletions
+43
View File
@@ -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()