diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aafeace --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +#MacOS +.DS_Store + +# Environment variables +.env \ No newline at end of file diff --git a/api/spotify.py b/api/spotify.py index efba289..b36d4c2 100644 --- a/api/spotify.py +++ b/api/spotify.py @@ -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, } diff --git a/api/templates/spotify-dark.html.j2 b/api/templates/spotify-dark.html.j2 index 5d832b8..34b28e3 100644 --- a/api/templates/spotify-dark.html.j2 +++ b/api/templates/spotify-dark.html.j2 @@ -32,6 +32,7 @@ } .song { + width: 300px; color: #f7f7f7; overflow:hidden; margin-top: 3px; @@ -42,6 +43,7 @@ } .artist { + width: 300px; color: #9f9f9f; font-size: 20px; margin-top: 4px; @@ -72,6 +74,18 @@ animation: sound 0ms -800ms linear infinite alternate; } + .spotify-logo { + position: fixed; + right: 20px; + top: 10px; + width: 25px; + filter: invert(1); + } + + a { + text-decoration: none; + } + div { font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji; } @@ -101,9 +115,16 @@
-
{{songName}}
-
{{artistName}}
-
{{contentBar|safe}}
+ +
{{songName}}
+
+ +
{{artistName}}
+
+
{{contentBar|safe}}
+
diff --git a/api/templates/spotify.html.j2 b/api/templates/spotify.html.j2 index a2614ac..e817bc1 100644 --- a/api/templates/spotify.html.j2 +++ b/api/templates/spotify.html.j2 @@ -31,6 +31,7 @@ } .song { + width: 300px; color: #666; overflow:hidden; margin-top: 3px; @@ -41,6 +42,7 @@ } .artist { + width: 300px; color: #b3b3b3; font-size: 20px; margin-top: 4px; @@ -71,6 +73,17 @@ animation: sound 0ms -800ms linear infinite alternate; } + .spotify-logo { + position: fixed; + right: 20px; + top: 10px; + width: 25px; + } + + a { + text-decoration: none; + } + div { font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji; } @@ -100,9 +113,16 @@
-
{{songName}}
-
{{artistName}}
+ +
{{songName}}
+
+ +
{{artistName}}
+
{{contentBar|safe}}
+