Commit Graph
12 Commits
Author SHA1 Message Date
mattandClaude Opus 5.5 faa74871a5 Metrics: database timing, pool state, DB-backed gauges, gunicorn
CI / lint (push) Successful in 11s
CI / test (push) Successful in 39s
CI / notify (push) Successful in 5s
- Statement latency by operation and connection-pool gauges via
  SQLAlchemy events
- Users, active users (1h/24h/7d) and now-playing gauges computed at
  scrape time, cached for 60s, from a NullPool engine that is safe in
  the gunicorn master; exports nothing (not an error) if the DB is down
- gunicorn.conf.py: multiprocess metrics aggregated across workers and
  served by the master on METRICS_PORT, stale files cleared at start,
  dead workers marked
- Tests cover labels, in-flight gauge, DB metrics, the collector and a
  real two-worker gunicorn aggregation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:15:30 +01:00
mattandClaude Opus 5.5 89f8589424 OpenAPI: document the Last.fm API and commit the exported spec
CI / lint (push) Successful in 10s
CI / test (push) Successful in 30s
CI / notify (push) Successful in 5s
- /2.0/ and /api/auth/ are described from the Last.fm method registry:
  method enum, per-method parameter tables, auth requirements, notes,
  request schemas and XML example responses
- Readable tags (Auth, Apps, Sessions, Tokens, Stats, Last.fm)
- docs/openapi.json is exported with `flask openapi write`; tests fail
  if it drifts from the code, if any route is undocumented, or if a UI
  route is missing its bearer-auth security declaration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:13:47 +01:00
mattandClaude Opus 5.5 b509cd2b60 Web UI: static HTML/CSS/JS frontend, hosted separately from the API
CI / lint (push) Successful in 9s
CI / test (push) Successful in 31s
CI / notify (push) Successful in 5s
- Plain HTML + vanilla JS modules, no build step; talks to /api/v1 with
  a bearer token and only ever inserts server data as text
- Overview: now-playing dot-matrix display with live progress, totals,
  30-day plays meter, top artists/tracks by period, recent plays
- History (paged, grouped by day), Apps (create/delete, reveal/copy
  keys, player setup details), Sessions (revoke), sign-in approval page
  for the Last.fm desktop auth flow, sign in and registration
- Light and dark themes, responsive to phone widths, vendored fonts
  (SIL OFL) so the UI has no third-party requests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:11:37 +01:00
mattandClaude Opus 5.5 0d49311848 Listening stats: Last.fm user.* methods and /api/v1/me
CI / lint (push) Successful in 12s
CI / test (push) Successful in 30s
CI / notify (push) Successful in 5s
- Stats service shared by both APIs: recent scrobbles, top artists,
  albums and tracks over Last.fm periods, per-day/week/month counts
  (with empty days filled) and totals
- Case-insensitive grouping that displays the most common spelling
- user.getInfo, user.getRecentTracks (now playing first, from/to),
  user.getTopArtists/Albums/Tracks with Last.fm paging attributes
- /api/v1/me: now-playing, recent, top/{artists,albums,tracks},
  counts and summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:05:20 +01:00
mattandClaude Opus 5.5 2702815a1e Scrobbling and now-playing
CI / lint (push) Successful in 12s
CI / test (push) Successful in 27s
CI / notify (push) Successful in 5s
- track.scrobble: batches of up to 50 (array params or a single track),
  Last.fm ignore rules (empty artist/track, too old, too new), duplicate
  submissions accepted but stored once
- track.updateNowPlaying: upserted per user, expiring after the track's
  duration; cleared when the same track is scrobbled
- Scrobble result, ignore reason, batch size, lag and now-playing metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 14:02:42 +01:00
mattandClaude Opus 5.5 7622f7433a Last.fm auth: mobile sessions and the desktop token flow
CI / test (push) Successful in 25s
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 9s
- auth.getMobileSession (username + password), auth.getToken and
  auth.getSession with Last.fm error codes 4/14/15
- /api/auth/ redirects clients' approval links to the web UI's
  approve page; /api/v1/tokens lets the UI show and approve a token
- Tokens expire after an hour, are single use and bound to their app
- The legacy md5 authToken form is deliberately unsupported (it needs
  unsalted password hashes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 14:01:12 +01:00
mattandClaude Opus 5.5 e026e56ee3 UI REST API: accounts, bearer auth, API apps, sessions, OpenAPI docs
CI / lint (push) Successful in 14s
CI / test (push) Successful in 28s
CI / notify (push) Successful in 5s
- flask-smorest API under /api/v1 with a uniform JSON error shape;
  spec at /api/openapi.json, Swagger UI at /api/docs, ReDoc at /api/redoc
- Register/login/logout/me with hashed, expiring bearer tokens,
  documented as an OpenAPI bearer security scheme
- API application and client-session management endpoints
- CORS restricted to the configured UI origin(s)
- Flask no longer serves static files: it is API-only
- Login and registration metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:59:59 +01:00
mattandClaude Opus 5.5 9af8a4be8b Last.fm API core: signatures, XML/JSON responses and dispatcher
CI / test (push) Successful in 21s
CI / lint (push) Successful in 45s
CI / notify (push) Successful in 5s
- /2.0/ dispatcher backed by a method registry that declares each
  method's params and signature/session requirements
- api_sig verification per the Last.fm auth spec
- XML (default) and Last.fm-style JSON rendering, including error shapes
  and HTTP statuses per error code
- Last.fm request, error and auth-failure metrics with bounded labels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:57:36 +01:00
mattandClaude Opus 5.5 ae8d3b65db CI: pin uv so setup doesn't depend on the GitHub API
CI / lint (push) Successful in 11s
CI / test (push) Successful in 23s
CI / notify (push) Successful in 4s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:56:04 +01:00
mattandClaude Opus 5.5 98c8f2e824 App factory, data model, initial migration and HTTP metrics
CI / lint (push) Successful in 9s
CI / test (push) Failing after 22s
CI / notify (push) Successful in 5s
- Flask app factory with env-driven config (.env loaded at import)
- SQLAlchemy models: users, API apps, UI tokens, Last.fm auth tokens,
  sessions, scrobbles (deduplicated) and now-playing
- Initial Alembic migration; CI checks migrations match the models
- Prometheus metric definitions, per-endpoint RED hooks with bounded
  labels, and a standalone metrics server
- docker compose Postgres with a test database; CI test job runs
  against a Postgres service container

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:55:04 +01:00
mattandClaude Opus 5.5 606348800b Allow CI to be run manually
CI / lint (push) Successful in 10s
CI / test (push) Successful in 10s
CI / notify (push) Successful in 5s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:51:58 +01:00
mattandClaude Opus 5.5 ccc0e0d416 Project skeleton with Gitea CI and ntfy notifications
CI / lint (push) Successful in 11s
CI / test (push) Successful in 12s
CI / notify (push) Successful in 4s
- Rename the project to "scrobbler" with a src/ layout (hatchling)
- ruff + pytest dev tooling and a smoke test
- CI workflow (lint, test) that reports every run to ntfy via a
  reusable composite action

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:46:26 +01:00