feat: Add spotify ascii curl page
All checks were successful
Check Code Quality / RuffCheck (push) Successful in 1m23s
Build Docker / BuildImage (push) Successful in 1m28s

This commit is contained in:
2026-03-18 22:41:38 +11:00
parent d7dc5cd6f3
commit df4a8da5df
3 changed files with 95 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
from flask import redirect, render_template, request, Blueprint, url_for
from tools import json_response, isCLI
from ascii_art import image_url_to_ascii
import os
import requests
import time
@@ -106,7 +107,9 @@ def currently_playing():
"""Public endpoint showing your current track."""
track = get_playing_spotify_track()
if isCLI(request):
return json_response(request, {"spotify": track}, 200)
if "album_art" in track:
track["ascii_art"] = image_url_to_ascii(track["album_art"], new_width=40)
return render_template("spotify.ascii", track=track)
# Render a simple HTML page for browsers
return render_template("spotify.html", track=track)