Add spotify link for song and artist

- Added Spotify link to song title
- Added Spotify logo svg that takes the user to Spotify to listen to the currently playing song
- Added Spotify link to song artist
This commit is contained in:
AlexandrosAlexiou
2021-11-29 21:45:15 +02:00
committed by Andrew Novac
parent a301a69078
commit 0bf396a69f
4 changed files with 59 additions and 8 deletions

View File

@@ -84,9 +84,10 @@ def barGen(barCount):
left += 4
return barCSS
def getTemplate():
try:
file = open("api/templates.json","r")
file = open("api/templates.json", "r")
templates = json.loads(file.read())
return templates["templates"][templates["current-theme"]]
except Exception as e:
@@ -114,20 +115,24 @@ def makeSVG(data):
else:
item = data["item"]
currentStatus = "Vibing to:"
if item["album"]["images"] == []:
image = PLACEHOLDER_IMAGE
else :
else:
image = loadImageB64(item["album"]["images"][1]["url"])
artistName = item["artists"][0]["name"].replace("&", "&")
songName = item["name"].replace("&", "&")
songURI = item["external_urls"]["spotify"]
artistURI = item["artists"][0]["external_urls"]["spotify"]
dataDict = {
"contentBar": contentBar,
"barCSS": barCSS,
"artistName": artistName,
"songName": songName,
"songURI": songURI,
"artistURI": artistURI,
"image": image,
"status": currentStatus,
}