did a few things, most notably 88x31s

Signed-off-by: Nyx Tutt <me@everypizza.im>
This commit is contained in:
Nyx 2025-02-24 10:15:55 -06:00
parent 1196e25a53
commit 0e04fcc882
12 changed files with 47 additions and 7 deletions

View file

@ -1,11 +1,24 @@
#!/usr/bin/env python #!/usr/bin/env python
from flask import Flask, render_template, make_response from flask import Flask, render_template, make_response, send_from_directory
import requests import requests
import os
apiRoot = "https://api.listenbrainz.org" apiRoot = "https://api.listenbrainz.org"
user = "everypizza" user = "everypizza"
buttons = [
("assets/88x31s/benjae.nekoweb.org.gif", "https://benjae.nekoweb.org"),
("assets/88x31s/freetards.xyz.gif", "https://freetards.xyz"),
("assets/88x31s/fsky.io.webp", "https://fsky.io"),
("assets/88x31s/nyx.everypizza.im.webp", "https://nyx.everypizza.im"),
("assets/88x31s/purplebored.pl.gif", "https://purplebored.pl"),
("assets/88x31s/squarebowl.club.gif", "https://squarebowl.club"),
("assets/88x31s/synth.download.svg", "https://synth.download"),
("assets/88x31s/telepath.im.png", "https://telepath.im"),
("assets/88x31s/voxel.fsky.io.webp", "https://voxel.fsky.io"),
]
app = Flask(__name__) app = Flask(__name__)
countFile = "visitorCount.txt" countFile = "visitorCount.txt"
@ -28,10 +41,16 @@ def increment_visitor_count():
def index(): def index():
increment_visitor_count() increment_visitor_count()
data = requests.get(apiRoot + "/1/user/" + user + "/playing-now") data = requests.get(apiRoot + "/1/user/" + user + "/playing-now")
track = data.json()['payload']['listens'][0]['track_metadata']['track_name'] if not data.json()['payload']['listens']:
artist = data.json()['payload']['listens'][0]['track_metadata']['artist_name'] nowPlaying = False
album = data.json()['payload']['listens'][0]['track_metadata']['release_name'] nowPlayingString = "nothing is playing right now."
return render_template('index.j2', visitor=get_visitor_count(), user=user, title=track, artist=artist, album=album) else:
track = data.json()['payload']['listens'][0]['track_metadata']['track_name']
artist = data.json()['payload']['listens'][0]['track_metadata']['artist_name']
album = data.json()['payload']['listens'][0]['track_metadata']['release_name']
nowPlayingString = f"now playing for <b>{user}</b>: <b>{track}</b> by <b>{artist}</b> from <b>{album}</b>"
return render_template('index.j2', np=nowPlayingString, visitor=get_visitor_count(), buttons=buttons)
@app.route('/assets/index.css') @app.route('/assets/index.css')
def indexStyle(): def indexStyle():
@ -40,5 +59,14 @@ def indexStyle():
response.mimetype = "text/css" response.mimetype = "text/css"
return response return response
@app.route('/static/assets/88x31s/<path:filename>')
def serve_dir(filename):
directory = 'templates/assets/88x31s'
return send_from_directory(directory, filename)
@app.route('/todo')
def todo():
return render_template('todo.html')
if __name__ == '__main__': if __name__ == '__main__':
app.run(host="0.0.0.0", port=8080) app.run(host="0.0.0.0", port=8080)

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

View file

@ -0,0 +1 @@
<svg viewBox="0 0 88 31" xmlns="http://www.w3.org/2000/svg"><foreignObject x="0" y="0" width="88" height="31"><pre xmlns="http://www.w3.org/1999/xhtml" style="color-scheme:light dark;display: block;width:88px;height:31px;font-size:8px;box-shadow:1px 1px 0 0 inset,graytext -1px -1px 0 0 inset;padding:5px;box-sizing:border-box;color:blue;background:red;margin:0">&gt;Snit was here</pre></foreignObject></svg>

After

Width:  |  Height:  |  Size: 409 B

View file

@ -70,7 +70,7 @@
<p> <p>
<ul> <ul>
<li> <li>
<a href="todo.html">to-do list</a> <a href="todo">to-do list</a>
</li> </li>
</ul> </ul>
</p> </p>
@ -78,10 +78,20 @@
now playing now playing
</h2> </h2>
<p> <p>
now playing for <b>{{ user }}</b>: <b>{{ title }}</b> by <b>{{ artist }}</b> from <b>{{ album }}</b> <b>{{ rawData }}</b> {{ np }}
<br> <br>
<small> <small>
data is from listenbrainz. data is from listenbrainz.
</small> </small>
</p> </p>
<h2>
88x31s
</h2>
<p>
{% for image, link in buttons %}
<a href="{{ link }}">
<img src="/static/{{ image }}" alt="{{ image }}" width="88" height="31">
</a>
{% endfor %}
</p>
</body> </body>