Commit Graph

35 Commits

Author SHA1 Message Date
Test User 4e44f672e8 Persist queues as fs-provider folders
Queues now survive restarts, built entirely on the fs provider:
fsdy::Client is instance-mountable and a second, read-only instance
serves <config>/crabidy/queues/ as /queues. Every queue is a folder of
order-prefixed link track files plus a hidden state sidecar, written
only by the new QueueStore (tmp-and-swap). The playback loop streams
every queue change through a latest-wins watch channel to a debouncing
persister task and restores queues/current/ (tracks, position,
modifiers) at startup without autoplay. w on the queue pane asks for a
name and drives the previously stubbed SaveQueue rpc; reloading a
saved queue is just queueing /queues/<name>, since link entries
rewrite to their targets at listing time. The old "no links into /fs"
parse rejection gave way to one-hop link semantics so queues can
reference fs tracks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 10:41:49 +02:00
Test User 4dd5f01217 Add a filesystem provider for serialized track nodes
A new fsdy crate exposes a configured root directory as /fs:
*.track.toml files are track nodes carrying metadata plus exactly one
playable reference — a local audio file, an http(s) URL, or a
crabidy-internal link. Link tracks rewrite Track.path to the target at
listing time, so playback routes through the existing prefix routing;
links into /fs are rejected, making chains impossible. Paths are
percent-encoded segments validated in one place (no root escape), the
orchestrator wires the provider optionally (a broken local config only
costs the /fs subtree), and the default chunked resolve walk provides
progressive queueing for free.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 01:58:55 +02:00
Test User ccab43a133 Queue large collections progressively
Resolving a nested node used to collect every track before the queue
changed: one broadcast at the very end, playback only after the full
walk, and the playback loop blocked for the duration. Now provider
resolution streams bounded chunks (tidaldy: one per 50-track page), the
playback loop applies and broadcasts each chunk as it lands, playback
starts with the first chunk, and Replace/Clear cancel in-flight
resolves down to the HTTP fetch. Queue.resolving (additive proto field)
drives an animated-dots pseudo-item in the TUI queue pane.

Also fixes Enter on a non-queueable library item blanking the queue
while audio kept playing, and the reversed album order left by the old
LIFO walk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 01:08:34 +02:00
Test User d741523e53 Add Tidal search as creatable library nodes
Pressing % inside /tidal/search opens an input line; the entered term
becomes a tree node whose contents are the search results: track hits
queueable in place, artist and album hits as canonical /tidal/artists
paths. New CreateLibraryNode rpc + is_creatable flags (wire-compatible),
ProviderClient::create_lib_node routed by prefix, percent-encoded term
segments in crabidy-core, and a modal input overlay in the TUI with
creatable nodes marked [%]. Search terms live in memory for the process
lifetime; term nodes are deliberately not queueable so the resolve sweep
cannot drag whole discographies into the queue.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 17:58:44 +02:00
AI User 21e1b10c0b Drop redundant log-to-tracing bridge init
tracing-subscriber .init() already installs the LogTracer via its
default tracing-log feature; the explicit init only produced a startup
warning. Remove it and the direct tracing-log dependency.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 22:01:22 +02:00
AI User d504ebc85f Fix intermittent playback stops and harden the queue
Root causes found and fixed:

- QueueManager could panic and kill the playback task permanently:
  is_last_track() underflowed on an empty queue, remove_tracks accepted
  pos == len (Vec::remove panic) and corrupted positions when removing
  multiple tracks (indices shifted mid-loop), shuffle_behind indexed
  out of range on an empty play order, insert_tracks shifted play-order
  entries by the queue length instead of the inserted count and then
  assert!()ed on the resulting inconsistency, and clear() left
  play_order stale. All mutation methods are now guarded, multi-remove
  works highest-position-first, and an inconsistent play order is
  rebuilt instead of panicking. Regression tests cover these cases.

- The tidal access token was only obtained at startup and never
  refreshed, so long-running sessions ended with every track fetch
  failing (playback just stopped at the next track boundary). Login
  state now lives behind a lock; tokens are refreshed proactively
  before expiry (5 min margin) and once reactively on a 401, and all
  API responses are status-checked (new ClientError::ApiError) instead
  of being fed to the JSON decoder blind. The http client also got a
  30s timeout so a hung connection cannot wedge the provider loop.

- (from the rodio rewrite, same bug class) end of stream used to be
  detected by string-comparing an io::Error message; any other decode
  or network error ended the stream silently without an EndOfStream
  message, so playback never advanced. EOS is now a guaranteed
  callback with a generation counter.

Plus workspace-wide clippy cleanup (zero warnings), cargo-machete
cleanup, and fmt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 22:00:22 +02:00
AI User 6d8bc7f166 Overhaul tracing: fix span misattribution, broaden coverage
The old pattern passed a Span in every channel message and entered it
with a guard that was held across await points, which misattributed
events from interleaved tasks. Messages are now {span, command} pairs:
the span is captured automatically at send time (Span::current) and the
consumer instruments the whole handler future with a child span
(playback_command/provider_command with a command name field), so events
are attributed correctly across the queue boundary and all the manual
in_current_span() plumbing is gone.

Also:
- server: EnvFilter with RUST_LOG support (default: own crates at
  debug, rest at info), log-crate bridge for symphonia/cpal
- cbd-tui: logs to a file under the state dir (the terminal belongs to
  the TUI), EnvFilter, no more println into the alternate screen
- tidaldy: fix misused levels (error->debug), structured fields,
  payload dumps moved to trace, login flow at info/warn
- no panic on missing notification daemon in the TUI
- no panic on backwards clock steps in QueueManager
- provider init errors propagate instead of expect()

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 21:48:00 +02:00
AI User 6eb5a87b15 Update all dependencies to current versions
- tonic 0.9 -> 0.14 (tonic-prost/tonic-prost-build split), prost 0.14
- ratatui 0.20 -> 0.30 (Frame no longer generic, Line instead of Spans),
  crossterm 0.29
- rodio 0.17 -> 0.22: replace the custom symphonia decoder with rodio's
  built-in decoder, seeking (try_seek) and position tracking (get_pos);
  end-of-stream is now signalled via an EmptyCallback source with a
  generation counter so a replaced track can never emit a stale EOS
- replace the vendored stream-download crate with the published
  stream-download 0.24 (rustls), with a 30s open timeout
- reqwest 0.12->0.13 (rustls/webpki-roots/query features), base64 0.22
  Engine API, rand 0.10, flume 0.12, thiserror 2, dirs 6, toml 1
- unify everything under [workspace.dependencies]; drop unused deps
  (once_cell, serde_json in server; confique, secrecy in tidaldy)
- devenv: add protobuf (protoc) for prost-build

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 21:41:10 +02:00
chmanie 7f48bca5df Split up cbd-tui into components 2023-06-11 20:06:06 +02:00
chmanie d970e372af TUI: Add config file and argument parsing w/ clap 2023-06-11 01:02:14 +02:00
Hans Mündelein 9be9039a05
Add shuffle and repeat for server 2023-06-09 16:02:35 +02:00
chmanie 606f9e6516 Use rust TLS for stream-downloader 2023-06-08 19:34:24 +02:00
chmanie 51cdf13953 Add stream-download package 2023-06-08 18:55:11 +02:00
Hans Mündelein a31608aae9
Integrate new audio player 2023-06-08 16:10:17 +02:00
chmanie d236d108e8 Adjust audio-player example 2023-06-08 14:54:36 +02:00
chmanie 983609e2f4 Implement full async player API 2023-06-08 14:40:09 +02:00
chmanie 85d6d263e1 Add more player API methods 2023-06-08 12:17:11 +02:00
chmanie 8f6dd152c8 First working version of audio player 2023-06-08 05:13:22 +02:00
chmanie 7f1e7dfd00 Add audio-player PoC 2023-06-08 02:01:49 +02:00
Hans Mündelein 4043865ad4
Fix broken song deadlock and improve observability 2023-06-03 13:04:59 +02:00
chmanie 553f34a111 Use proper config directory 2023-06-02 20:28:38 +02:00
chmanie 10abece425 Add rudimentary notification support 2023-05-30 11:59:15 +02:00
Hans Mündelein 46937b3d6e
Allow multiple concurrent clients receive streams 2023-05-28 09:21:17 +02:00
Hans Mündelein 9e1efb886a
Add first streaming server version 2023-05-26 19:11:55 +02:00
Hans Mündelein e231de87da
Switch to rustls and dn 2023-05-26 14:55:25 +02:00
chmanie acf34c2722 Add placeholders for request and stream testing 2023-05-23 14:42:53 +02:00
chmanie 596a97c99d Remove crabidy, graphql from cbd-tui 2023-05-23 13:43:48 +02:00
Hans Mündelein 0b9e6ceebe
Add server stubs for newly stuctred RPCs 2023-05-23 13:11:22 +02:00
chmanie 248c833280 Fix proto lint issues as much as possible 2023-05-23 00:04:15 +02:00
Hans Mündelein 0af8829987
Add cargo-server with liby service draft
It is not smart, fetches everything all the time  and totally hardcoded with the tidal client
But tidal login and library discovery with tidal should somewhat work.
2023-05-22 22:05:38 +02:00
Hans Mündelein 19f19cba2d
Add tidal provider
First draft of tidaldy that implements the crabidy provider trait.
2023-05-22 09:31:02 +02:00
chmanie 73cb9ddbda Add test gRPC server 2023-05-21 14:25:30 +02:00
Hans Mündelein f76ba00ce4
Remove legacy graphql stuff
Graphql is dead. Long live gRPC!!!
2023-05-19 17:19:19 +02:00
chmanie a681cbb739 Add tonic tooling and basic protobuf definitions 2023-05-19 15:07:06 +02:00
chmanie 861391f7d8 Add threaded ui model 2023-05-17 23:45:18 +02:00