spotify-player: back to own client_id, cut per-action request burst

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-15 22:25:53 +01:00
parent 3604875b55
commit 8b348d8c47

View file

@ -91,22 +91,43 @@ in
# ~180 requests per launch into a shared rate-limit bucket (429s). 12 # ~180 requests per launch into a shared rate-limit bucket (429s). 12
# rounds five seconds apart covers the same 60s for a fifth of the calls. # rounds five seconds apart covers the same 60s for a fifth of the calls.
# Both loops in this file are `for _ in 0..5` / `from_secs(1)`; the leading # Both loops in this file are `for _ in 0..5` / `from_secs(1)`; the leading
# indentation is what pins each replacement to initialize_playback. # indentation is what pins each replacement to the intended one.
#
# The third replacement hits the other loop, in retry_playback_state: it
# re-reads the playback state five times after *every* playback-changing
# action, so one flick of the volume wheel costs a write plus five reads
# per notch. The state is updated optimistically client-side anyway, so
# two confirmations are plenty.
postPatch = (old.postPatch or "") + '' postPatch = (old.postPatch or "") + ''
substituteInPlace spotify_player/src/client/mod.rs \ substituteInPlace spotify_player/src/client/mod.rs \
--replace-fail " for _ in 0..5 {" \ --replace-fail " for _ in 0..5 {" \
" for _ in 0..12 {" \ " for _ in 0..12 {" \
--replace-fail " let delay = std::time::Duration::from_secs(1);" \ --replace-fail " let delay = std::time::Duration::from_secs(1);" \
" let delay = std::time::Duration::from_secs(5);" " let delay = std::time::Duration::from_secs(5);" \
--replace-fail " for _ in 0..5 {" \
" for _ in 0..2 {"
''; '';
}); });
settings = { settings = {
enable_audio_visualization = true; enable_audio_visualization = true;
# No `client_id` on purpose: the bundled default (ncspot's) has extended # Our own Spotify app rather than the bundled default (ncspot's client ID,
# quota mode and predates the 2024-11-27 Web API changes. Our own app is # shared by every spotify-player/ncspot install). Upstream recommends the
# newer, so it sits in the restricted quota and 404s on search, browse # default because it has extended quota mode, but its rate-limit bucket is
# categories and Made-For-You — upstream issues #617 / #890. Sharing the # shared across every user of it, and we hit 429s on it just adjusting the
# default ID does not cost us rate limit here; upstream recommends it. # volume. Our own app gets a private bucket.
#
# The cost of a post-2024-11-27 app is restricted quota: Spotify returns
# its own editorial/algorithmic playlists as null, so Discover Weekly,
# Made-For-You and browse categories are missing. That used to break
# *search* outright (upstream #617/#621) because one null sank the whole
# deserialization, but rspotify 0.15.3 — pinned by 0.24.1 — drops null
# page items instead (`vec_without_nulls`), so search works again.
# Public PKCE client, no secret involved, so it's fine in the repo.
# Redirect URI registered: http://127.0.0.1:8989/login
client_id = "265506bc7bbd4032bf0fee708b321d3e";
# Each notch fires a volume write plus a burst of confirmation polls, so
# halve the notches needed to cross the range.
volume_scroll_step = 10;
}; };
# The home-manager module only writes keymap.toml when `keymaps` is # The home-manager module only writes keymap.toml when `keymaps` is
# non-empty, so `actions` alone would silently emit nothing. Restating a # non-empty, so `actions` alone would silently emit nothing. Restating a