Proper binary-library boundary #8
Owner
- Fixed binary/library boundary: removed five duplicate mod declarations from src/main.rs that caused the binary to recompile library source files into its own namespace. Replaced with pub(crate) use librespot_dl::{collection, download, error, provider} so the binary consumes the compiled library artifact.
- Added UserInput enum and MusicSourceProvider::classify_input: provider-specific URI parsing no longer lives in the binary. Both interactive.rs and script.rs now dispatch via provider.classify_input(line) and match on TrackUri / PlaylistUri / SearchQuery. Eliminated duplicated to_spotify_uri / to_track_uri / is_playlist functions and the provider-specific if/else chain in each CLI module.
- Added QueueEntry::for_track: constructor in src/download/queue.rs consolidates output-path computation and filesystem stat into one place. Eliminates duplicated make_entry in interactive.rs and manual QueueEntry construction in script.rs.
- Added DownloadQueue session lifecycle helpers: all_terminal(), prepare_for_restore(valid_partial_ids), and skip_existing() are now library methods with unit tests.
- Added DownloadSession<P> in src/download/session.rs: owns the queue, provider Arc, channels, concurrency limit, and byte counters. spawn_pending, handle_msg, cancel_all, and reset_cancel are methods on the session rather than free functions in the binary. The interactive event loop is reduced to a thin dispatcher that creates a session and selects on terminal events and worker messages.
- Eliminated OGG_320_BYTES_PER_SEC duplication: declared once as pub const in src/download/worker.rs; both CLI modules import it.
- Fixed binary/library boundary: removed five duplicate mod declarations from src/main.rs that caused the binary to recompile library source files into its own namespace. Replaced with pub(crate) use librespot_dl::{collection, download, error, provider} so the binary consumes the compiled library artifact.
- Added UserInput enum and MusicSourceProvider::classify_input: provider-specific URI parsing no longer lives in the binary. Both interactive.rs and script.rs now dispatch via provider.classify_input(line) and match on TrackUri / PlaylistUri / SearchQuery. Eliminated duplicated to_spotify_uri / to_track_uri / is_playlist functions and the provider-specific if/else chain in each CLI module.
- Added QueueEntry::for_track: constructor in src/download/queue.rs consolidates output-path computation and filesystem stat into one place. Eliminates duplicated make_entry in interactive.rs and manual QueueEntry construction in script.rs.
- Added DownloadQueue session lifecycle helpers: all_terminal(), prepare_for_restore(valid_partial_ids), and skip_existing() are now library methods with unit tests.
- Added DownloadSession\<P\> in src/download/session.rs: owns the queue, provider Arc, channels, concurrency limit, and byte counters. spawn_pending, handle_msg, cancel_all, and reset_cancel are methods on the session rather than free functions in the binary. The interactive event loop is reduced to a thin dispatcher that creates a session and selects on terminal events and worker messages.
- Eliminated OGG_320_BYTES_PER_SEC duplication: declared once as pub const in src/download/worker.rs; both CLI modules import it.
maleszka
added 7 commits 2026-07-02 19:15:28 +02:00
Merge pull request 'Proper binary-library boundary' (#8) from feature/refactor into main
Merge pull request 'Proper binary-library boundary' (#8) from feature/refactor into main
Merge pull request 'Proper binary-library boundary' (#8) from feature/refactor into main
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?