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>
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 14:02:42 +01:00
1 parent 7622f7433a
commit 2702815a1e
6 files changed
+498 -5

No files matched your search

+8 -3
View File
@@ -27,9 +27,14 @@ def test_revoked_session_key_stops_working(client, auth, api_app, session_key):
assert client.delete(f"/api/v1/sessions/{sessions[0]['id']}", headers=auth).status_code == 204
params = signed(
{"method": "track.updateNowPlaying", "api_key": api_app.api_key, "sk": session_key},
{
"method": "track.updateNowPlaying",
"api_key": api_app.api_key,
"sk": session_key,
"artist": "A",
"track": "T",
},
api_app.shared_secret,
)
# The method is registered in a later step; the session check runs first either way.
response = client.post("/2.0/", data={**params, "format": "json"})
assert response.get_json()["error"] in (3, 9)
assert response.get_json()["error"] == 9