Compare commits

...

4 commits

Author SHA256 Message Date
ed3da87da5 update todo 2025-02-24 17:55:12 -06:00
44af0418bf nyxbuttons 2025-02-24 17:55:06 -06:00
0e04fcc882 did a few things, most notably 88x31s
Signed-off-by: Nyx Tutt <me@everypizza.im>
2025-02-24 10:15:55 -06:00
1196e25a53 now playing 2025-02-24 00:02:33 -06:00
13 changed files with 73 additions and 6 deletions

View file

@ -1,6 +1,26 @@
#!/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 os
apiRoot = "https://api.listenbrainz.org"
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/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"),
]
nyxbuttons = [
("assets/88x31s/nyx.everypizza.im.webp", "https://nyx.everypizza.im"),
]
app = Flask(__name__)
@ -23,7 +43,17 @@ def increment_visitor_count():
@app.route('/')
def index():
increment_visitor_count()
return render_template('index.j2', visitor=get_visitor_count())
data = requests.get(apiRoot + "/1/user/" + user + "/playing-now")
if not data.json()['payload']['listens']:
nowPlaying = False
nowPlayingString = "nothing is playing right now."
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, nyxbuttons=nyxbuttons)
@app.route('/assets/index.css')
def indexStyle():
@ -32,5 +62,14 @@ def indexStyle():
response.mimetype = "text/css"
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__':
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,8 +70,37 @@
<p>
<ul>
<li>
<a href="todo.html">to-do list</a>
<a href="todo">to-do list</a>
</li>
</ul>
</p>
<h2>
now playing
</h2>
<p>
{{ np }}
<br>
<small>
data is from listenbrainz.
</small>
</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>
<h3>
this one's 88x31
</h3>
<p>
{% for image, link in nyxbuttons %}
<a href="{{ link }}">
<img src="/static/{{ image }}" alt="{{ image }}" width="88" height="31">
</a>
{% endfor %}
</body>

View file

@ -21,9 +21,6 @@
<li>
look into more optimizations
</li>
<li>
switch this site to a flask app
</li>
</ul>
</p>
</body>