From d4d6b472259111123287ccb81f9ef6666fc07ffe Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sun, 26 Oct 2025 21:31:30 +1100 Subject: [PATCH] feat: Add spotify to api routes --- blueprints/api.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/blueprints/api.py b/blueprints/api.py index 942ab62..660b6ac 100644 --- a/blueprints/api.py +++ b/blueprints/api.py @@ -7,6 +7,7 @@ from mail import sendEmail from tools import getClientIP, getGitCommit, json_response, parse_date, get_tools_data from blueprints.sol import sol_bp from dateutil import parser as date_parser +from blueprints.spotify import get_spotify_track # Constants HTTP_OK = 200 @@ -43,6 +44,8 @@ def help(): "/project": "Get the current project from git", "/version": "Get the current version of the website", "/page_date?url=URL&verbose=BOOL": "Get the last modified date of a webpage (verbose is optional, default false)", + "/tools": "Get a list of tools used by Nathan Woodburn", + "/playing": "Get the currently playing Spotify track", "/status": "Just check if the site is up", "/ping": "Just check if the site is up", "/help": "Get this help message" @@ -180,6 +183,14 @@ def tools(): return json_response(request, {"tools": tools}, HTTP_OK) +@api_bp.route("/playing") +def playing(): + """Get the currently playing Spotify track.""" + track_info = get_spotify_track() + if "error" in track_info: + return json_response(request, track_info, HTTP_OK) + return json_response(request, {"spotify": track_info}, HTTP_OK) + @api_bp.route("/page_date") def page_date(): url = request.args.get("url")