Song name limit

This commit is contained in:
novatorem
2020-08-23 10:34:18 -04:00
parent 85dc27f840
commit ad63ff53c7
4 changed files with 46 additions and 34 deletions

View File

@@ -42,3 +42,9 @@ curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Authorizat
* `SPOTIFY_SECRET_ID` * `SPOTIFY_SECRET_ID`
* Deploy! * Deploy!
## ReadMe
You can now use the following in your readme:
```[![Spotify](https://novatorem.vercel.app/api/spotify-playing)](https://open.spotify.com/user/USER_NAME)```

View File

@@ -77,7 +77,7 @@ def loadImageB64(url):
return b64encode(resposne.content).decode("ascii") return b64encode(resposne.content).decode("ascii")
def makeSVG(data): def makeSVG(data):
barCount = 85 barCount = 83
contentBar = "".join(["<div class='bar'></div>" for i in range(barCount)]) contentBar = "".join(["<div class='bar'></div>" for i in range(barCount)])
barCSS = barGen(barCount) barCSS = barGen(barCount)

View File

@@ -6,17 +6,13 @@
.main { .main {
display: flex; display: flex;
} width: "480px";
height: "133px";
.art {
float: left;
width: 33.33%;
} }
.container { .container {
background-color: #121212; border-radius: 5px;
border-radius: 10px; padding: 10px 10px 10px 0px;
padding: 10px 10px
} }
.playing { .playing {
@@ -32,20 +28,31 @@
color: #ff1616; color: #ff1616;
} }
.artist { .art {
font-weight: bold; float: left;
font-size: 24px; width: 27%;
color: #fff; margin-left: -5px;
text-align: left; }
margin-top: 5px;
.text {
width: 71%;
} }
.song { .song {
font-size: 24px;
color: #666;
text-align: center;
margin-top: 3px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.artist {
font-size: 20px; font-size: 20px;
color: #b3b3b3; color: #b3b3b3;
text-align: left; text-align: center;
margin-top: 15px; margin-bottom: 5px;
margin-bottom: 15px;
} }
.logo { .logo {
@@ -55,18 +62,20 @@
.cover { .cover {
border-radius: 5px; border-radius: 5px;
margin-top: 9px; height: 100px;
width: 100px;
} }
#bars { #bars {
height: 30px; height: 30px;
bottom: 23px;
margin: -20px 0 0 0px; margin: -20px 0 0 0px;
position: absolute; position: absolute;
width: 40px; width: 40px;
} }
.bar { .bar {
background: #53b14f; background: #1DB954cc;
bottom: 1px; bottom: 1px;
height: 3px; height: 3px;
position: absolute; position: absolute;
@@ -82,25 +91,25 @@
100% { 100% {
opacity: 1; opacity: 1;
height: 28px; height: 15px;
} }
} }
</style> </style>
<div class="main"> <div class="main">
<a class="art" href="{}" target="_BLANK"> <a class="art" href="{}" target="_BLANK">
<center> <center>
<img src="data:image/png;base64, {{img}}" width="200" height="200" class="cover" /> <img src="https://source.unsplash.com/random/500x500" class="cover" />
</center> </center>
</a> </a>
<div class="text"> <div class="text">
<div class="artist">Artist</div>
<div class="song">Song</div> <div class="song">Song</div>
<div id="bars"></div> <div class="artist">Arist</div>
<div id="bars">
{{content_bar|safe}}
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -43,6 +43,9 @@
color: #666; color: #666;
text-align: center; text-align: center;
margin-top: 3px; margin-top: 3px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
} }
.artist { .artist {
@@ -94,9 +97,7 @@
{{css_bar|safe}} {{css_bar|safe}}
</style> </style>
{% if song_name %}
<div class="main"> <div class="main">
<a class="art" href="{}" target="_BLANK"> <a class="art" href="{}" target="_BLANK">
<center> <center>
@@ -111,10 +112,6 @@
{{content_bar|safe}} {{content_bar|safe}}
</div> </div>
</div> </div>
{% else %}
<div class="playing not-play">Nothing playing on Spotify</div>
{% endif %}
</div> </div>
</div> </div>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB