Browse Source

Restyled

add-license-1
novatorem 5 years ago
parent
commit
e5c3a01a71
3 changed files with 146 additions and 27 deletions
  1. +1
    -2
      api/spotify-playing.py
  2. +106
    -0
      api/templates/preview.html
  3. +39
    -25
      api/templates/spotify.html.j2

+ 1
- 2
api/spotify-playing.py View File

@ -42,7 +42,6 @@ def refresh_token():
response = requests.post(SPOTIFY_URL_REFRESH_TOKEN, data=data, headers=headers)
repsonse_json = response.json()
print(repsonse_json)
return repsonse_json["access_token"]
@ -106,7 +105,7 @@ def make_svg(data):
if data == {}:
# Get recently play
title_text = "Currently playing"
title_text = "Last listening to"
content_bar = ""
recent_plays = get_recently_play()


+ 106
- 0
api/templates/preview.html View File

@ -0,0 +1,106 @@
<div xmlns="http://www.w3.org/1999/xhtml" class="container">
<style>
div {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
}
.main {
display: flex;
}
.art {
float: left;
width: 33.33%;
}
.container {
background-color: #121212;
border-radius: 10px;
padding: 10px 10px
}
.playing {
font-weight: bold;
color: #53b14f;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.not-play {
color: #ff1616;
}
.artist {
font-weight: bold;
font-size: 24px;
color: #fff;
text-align: left;
margin-top: 5px;
}
.song {
font-size: 20px;
color: #b3b3b3;
text-align: left;
margin-top: 15px;
margin-bottom: 15px;
}
.logo {
margin-left: 5px;
margin-top: 5px;
}
.cover {
border-radius: 5px;
margin-top: 9px;
}
#bars {
height: 30px;
margin: -20px 0 0 0px;
position: absolute;
width: 40px;
}
.bar {
background: #53b14f;
bottom: 1px;
height: 3px;
position: absolute;
width: 3px;
animation: sound 0ms -800ms linear infinite alternate;
}
@keyframes sound {
0% {
opacity: .35;
height: 3px;
}
100% {
opacity: 1;
height: 28px;
}
}
</style>
<div class="main">
<a class="art" href="{}" target="_BLANK">
<center>
<img src="data:image/png;base64, {{img}}" width="200" height="200" class="cover" />
</center>
</a>
<div class="text">
<div class="artist">Artist</div>
<div class="song">Song</div>
<div id="bars"></div>
</div>
</div>
</div>

+ 39
- 25
api/templates/spotify.html.j2 View File

@ -6,6 +6,15 @@
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
}
.main {
display: flex;
}
.art {
float: left;
width: 33.33%;
}
.container {
background-color: #121212;
border-radius: 10px;
@ -27,17 +36,17 @@
.artist {
font-weight: bold;
font-size: 20px;
font-size: 24px;
color: #fff;
text-align: center;
text-align: left;
margin-top: 5px;
}
.song {
font-size: 16px;
font-size: 20px;
color: #b3b3b3;
text-align: center;
margin-top: 5px;
text-align: left;
margin-top: 15px;
margin-bottom: 15px;
}
@ -66,7 +75,7 @@
width: 3px;
animation: sound 0ms -800ms linear infinite alternate;
}
@keyframes sound {
0% {
opacity: .35;
@ -84,26 +93,31 @@
{% if song_name %}
<div class="playing">
{{title_text}} on
<img class="logo"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAE5ElEQVRYR81WS08bVxQ+dzweY48fQCCBllJDmqpRSx6gKizSiAUbILZjA21KVEhF20hNlLb/IKu2m3QRKaqQogIRkAXhYQxFSJGCQqVKrVSBQtpCFqEQkrQhxnb8Yjxzp7oTmdjjsWd4LHIlLzz3PL57zvedexG8Qgu9Qlhg22Bqumr0+/L2VdAMOpBvtdgCoedBnhPvsw/YpcFLg9x2DrklMA19DVajkf4B0dQnAMDkSJgQedwfWot9fevcraBWYJrA1HXX5RUWWG8jhGq1Bk7aiVj8PfGfWOc754uq+aqCOXXT8bFOTw2oBVLb5zmhw9s6fj2XXU4wniFnF6LRF2qJtO6LPPQMN3s/zWafFcxuA0kCwILYO+IZO6sESBHMbrUmWwVwQjw70jLWK9/PAEPIuqfQFtNa+u3acU8wKyd1BhjPqPNXJdVgHkP8WRwiqxGI/RsDLsSBiEXQGXRgKDCAqcQk/RgbA4hS1QXx/WPYPVaTepg0LzJHT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JuuU1yh6b+pgLGSF2hdNRpAKBzAOOxgAejfu5C6hxRO4hqm7IFaLjSYKCL8Fs6HfOO1WK1haKhYCKKF3AA30++3NSSa1bTVgPthv22K7MbyeUx/gfIiuIzZiZJFQAAAABJRU5ErkJggg==" />
</div>
<div class="artist">{{artist_name}}</div>
<div class="song">{{song_name}}</div>
<div id='bars'>
{{content_bar|safe}}
<div class="main">
<a class="art" href="{}" target="_BLANK">
<center>
<img src="data:image/png;base64, {{img}}" width="300" height="300" class="cover" />
</center>
</a>
<div class="text">
<div class="playing">
{{title_text}} on
<img class="logo"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAE5ElEQVRYR81WS08bVxQ+dzweY48fQCCBllJDmqpRSx6gKizSiAUbILZjA21KVEhF20hNlLb/IKu2m3QRKaqQogIRkAXhYQxFSJGCQqVKrVSBQtpCFqEQkrQhxnb8Yjxzp7oTmdjjsWd4LHIlLzz3PL57zvedexG8Qgu9Qlhg22Bqumr0+/L2VdAMOpBvtdgCoedBnhPvsw/YpcFLg9x2DrklMA19DVajkf4B0dQnAMDkSJgQedwfWot9fevcraBWYJrA1HXX5RUWWG8jhGq1Bk7aiVj8PfGfWOc754uq+aqCOXXT8bFOTw2oBVLb5zmhw9s6fj2XXU4wniFnF6LRF2qJtO6LPPQMN3s/zWafFcxuA0kCwILYO+IZO6sESBHMbrUmWwVwQjw70jLWK9/PAEPIuqfQFtNa+u3acU8wKyd1BhjPqPNXJdVgHkP8WRwiqxGI/RsDLsSBiEXQGXRgKDCAqcQk/RgbA4hS1QXx/WPYPVaTepg0LzJHTBZmcy5wQQ5mL89CeCUMIGqvAQFjLjeD/aQdiqqLsoKLh/nCiTMT68nIaWA8Q45riKY6k5szF2YgEU5oR5HFkn2dhUNfHQLjXmOaBRZw34jHRwaotNLANHtdG6mTdaF3AVZvrwJCCNgyFoqOFIHtgA2MxUbQGXXSdyxg4MM8RJ9EYf2vdfDf80PsaUyxkqSNt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{{content_bar|safe}}
</div>
</div>
{% else %}
<div class="playing not-play">Nothing playing on Spotify</div>
{% endif %}
</div>
<a href="{}" target="_BLANK">
<center>
<img src="data:image/png;base64, {{img}}" width="300" height="300" class="cover" />
</center>
</a>
{% else %}
<div class="playing not-play">Nothing playing on Spotify</div>
{% endif %}
</div>
</foreignObject>

Loading…
Cancel
Save