Skip to content

Commit 9a75333

Browse files
program247365claude
andcommitted
docs: document Spotify search overlay
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 451f349 commit 9a75333

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ uses librespot:
157157
- `ensure_track_available()` uses librespot's `AudioItem` availability to fail
158158
a single unplayable track at resolve time, so `resolve_url_with_startup`
159159
surfaces the "track unavailable" modal instead of playing silence
160+
- `src/spotify/search.rs` — catalog search via the public Web API (`/v1/search`),
161+
authorized with a bearer token minted from the librespot session
162+
(`session.token_provider().get_token(...)` — comma-separated scopes string).
163+
Returns `SearchResults { tracks, albums, playlists }` of `SearchItem`s whose
164+
`uri` is a valid `resolve()` target. Playlist `items` can contain literal
165+
`null`s (post-2024 API changes) — the parser filters them.
160166
- `src/spotify/sink.rs` — the bridge. librespot's `Player` pushes decoded PCM
161167
into a custom `Sink`; a bounded channel carries it to a rodio `Source`. The
162168
sink blocks under backpressure (throttling the decoder to real time); the
@@ -200,6 +206,13 @@ There are now two major UI modes:
200206
- "track unavailable" modal (`draw_replay_error`) — non-fatal overlay shown when
201207
a replay target can't be resolved; `d` prunes the dead row, any other key
202208
returns to the history browser.
209+
- Spotify search overlay (`/` from playback or the history browser;
210+
`draw_search_overlay`). Query focus: type, Enter searches (one blocking Web
211+
API call; a "searching…" frame is drawn first), Esc closes. Results focus:
212+
`j`/`k` move (headers are skipped), `gg`/`G` jump, `/` re-edits the query,
213+
Enter plays the selection through the normal replay rail
214+
(`LoopAction::ReplayTarget` in playback; `play_file_session` in the history
215+
browser). While open the overlay captures all keys; only Ctrl-C quits.
203216

204217
### Playlist behavior
205218

docs/usage.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ looper play --url "https://open.spotify.com/album/4aawyAB9vmqN3uQ7FjRGTy"
7979
| `f` | Toggle fullscreen visualizer |
8080
| `s` | Toggle favorite for the current track |
8181
| `p` / `Esc` | Toggle the played-songs panel |
82+
| `/` | Open Spotify search |
8283
| `q` / `Ctrl-C` | Quit |
8384

8485
Seeking (arrow keys or progress-bar drag) is available for local files and
@@ -102,3 +103,20 @@ hidden by default and opens over the minimal UI.
102103
| `p` / `Esc` | Close the panel |
103104

104105
Sort fields: time played, last played, platform, title, times played.
106+
107+
## Spotify search
108+
109+
`/` opens a Spotify catalog search from the playback screen or the history
110+
browser (requires the one-time `looper spotify login`). Type a query and press
111+
`Enter`; results are grouped into SONGS, ALBUMS, and PLAYLISTS.
112+
113+
| Key | Action |
114+
|-----|--------|
115+
| `j` / `k` | Move selection down / up |
116+
| `gg` / `G` | Jump to first / last result |
117+
| `/` | Edit the query again |
118+
| `Enter` | Play the selection (song loops; album/playlist plays through) |
119+
| `Esc` | Close search |
120+
121+
While the search overlay is open it captures all keys — `q` types a letter
122+
instead of quitting (`Ctrl-C` still works).

0 commit comments

Comments
 (0)