Commit 5a31f3c
authored
Custom playback integration phase 1: add
## Add `CustomQueue` scaffolding (Phase 1 — Foundation)
Phase 1 of the custom playback integration. Pure scaffolding with **zero behavioral change** — all existing codepaths remain untouched.
### Motivation
Issues #766, #878, #378, #767, #153, #739 all stem from the same root cause: the app delegates queue management to Spotify/librespot, which only exposes a ~100-track window. The custom queue system will replace this with app-managed batched URIs playback when streaming is active
### Changes
**New: `state/queue.rs`**
- `CustomQueue` struct — full track list, batch window (`batch_start..batch_end`), shuffle/repeat state, source context
- `AdvanceResult` / `RetreatResult` / `ShuffleMode` enums
- Core methods: `advance`, `retreat`, `truncate_batch_to_current`, `set_shuffle_mode`, `append_radio_tracks`, `next_batch`, `expected_next_track`, etc.
**Modified: `state/player.rs`**
- Added `custom_queue` fields to `PlayerState`
- `playing_context_id()` falls back to `custom_queue.source_context` for URIs playback
**Modified: `state/mod.rs`**
- Wired `mod queue; pub use queue::*`
- Added `State::should_use_custom_queue()` (requires streaming + config)
**Modified: `config/mod.rs`**
- Added `custom_queue: bool` to `AppConfig` (default `true`)
**Docs: `docs/config.md`, `examples/app.toml`**
- Documented the new config option
### Design notes
- **Batch manager model** — only intervenes at batch boundaries; librespot handles within-batch transitions
- **`batch_end` over fixed size** — enables `truncate_batch_to_current()` for non-interrupting shuffle/repeat changes
- **`EndOfTrack` as sole position tracker** — skip commands don't advance queue position, avoiding desync with user-queued tracks
- **Streaming-only + config-gated** — `should_use_custom_queue()` = `is_streaming_enabled() && custom_queue`CustomQueue scaffolding (#959)1 parent 9c4a595 commit 5a31f3c
7 files changed
Lines changed: 698 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
136 | 141 | | |
137 | 142 | | |
138 | 143 | | |
| |||
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
| 392 | + | |
| 393 | + | |
387 | 394 | | |
388 | 395 | | |
389 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
95 | 101 | | |
96 | 102 | | |
97 | 103 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
| |||
0 commit comments