mirror of
https://github.com/Alvin-Zilverstand/novatorem.git
synced 2026-03-06 11:07:09 +01:00
Fixes index out of bounds bug and adds global placeholder variable
This commit is contained in:
@@ -12,10 +12,10 @@ load_dotenv(find_dotenv())
|
|||||||
# Spotify scopes:
|
# Spotify scopes:
|
||||||
# user-read-currently-playing
|
# user-read-currently-playing
|
||||||
# user-read-recently-played
|
# user-read-recently-played
|
||||||
|
PLACEHOLDER_IMAGE = "PLACEHOLER_BASE64_IMAGE_HERE"
|
||||||
SPOTIFY_CLIENT_ID = os.getenv("SPOTIFY_CLIENT_ID")
|
SPOTIFY_CLIENT_ID = os.getenv("SPOTIFY_CLIENT_ID")
|
||||||
SPOTIFY_SECRET_ID = os.getenv("SPOTIFY_SECRET_ID")
|
SPOTIFY_SECRET_ID = os.getenv("SPOTIFY_SECRET_ID")
|
||||||
SPOTIFY_REFRESH_TOKEN = os.getenv("SPOTIFY_REFRESH_TOKEN")
|
SPOTIFY_REFRESH_TOKEN = os.getenv("SPOTIFY_REFRESH_TOKEN")
|
||||||
|
|
||||||
REFRESH_TOKEN_URL = "https://accounts.spotify.com/api/token"
|
REFRESH_TOKEN_URL = "https://accounts.spotify.com/api/token"
|
||||||
NOW_PLAYING_URL = "https://api.spotify.com/v1/me/player/currently-playing"
|
NOW_PLAYING_URL = "https://api.spotify.com/v1/me/player/currently-playing"
|
||||||
RECENTLY_PLAYING_URL = (
|
RECENTLY_PLAYING_URL = (
|
||||||
@@ -102,7 +102,12 @@ def makeSVG(data):
|
|||||||
else:
|
else:
|
||||||
item = data["item"]
|
item = data["item"]
|
||||||
currentStatus = "Vibing to:"
|
currentStatus = "Vibing to:"
|
||||||
|
|
||||||
|
if item["album"]["images"] == []:
|
||||||
|
image = PLACEHOLDER_IMAGE
|
||||||
|
else :
|
||||||
image = loadImageB64(item["album"]["images"][1]["url"])
|
image = loadImageB64(item["album"]["images"][1]["url"])
|
||||||
|
|
||||||
artistName = item["artists"][0]["name"].replace("&", "&")
|
artistName = item["artists"][0]["name"].replace("&", "&")
|
||||||
songName = item["name"].replace("&", "&")
|
songName = item["name"].replace("&", "&")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user