From bd29978b2a0d0d6def486fcdaa63bc8934d68045 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 5 May 2026 21:12:32 +0200 Subject: fix(daemon): robust auto-advance; ensure next track starts even if playback fails --- .gitignore | 1 + AGENTS.md | 55 + Cargo.lock | 3135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 21 + PLAN.md | 24 + TODO.md | 51 + src/audio.rs | 418 ++++++++ src/cli.rs | 186 ++++ src/config.rs | 180 ++++ src/daemon.rs | 574 ++++++++++ src/database.rs | 259 +++++ src/main.rs | 18 + src/playback.rs | 131 +++ src/scrobbler.rs | 75 ++ 14 files changed, 5128 insertions(+) create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 PLAN.md create mode 100644 TODO.md create mode 100644 src/audio.rs create mode 100644 src/cli.rs create mode 100644 src/config.rs create mode 100644 src/daemon.rs create mode 100644 src/database.rs create mode 100644 src/main.rs create mode 100644 src/playback.rs create mode 100644 src/scrobbler.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..31f1205 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,55 @@ +# Agent Instructions for rsplayer + +## Overview +Rust CLI music player daemon for GNU/Linux with shell autocompletion, SQLite library database, Unix socket IPC, and Last.fm/ListenBrainz scrobbling. + +## Required Verification Commands +Run these before completing any task: +- Lint: `cargo clippy -- -D warnings` +- Format check: `cargo fmt --check` +- Test: `cargo test` +- Build: `cargo build` + +## Development Workflow +- Use `rsp restart` or `rsplayer restart` to kill any running daemon and start a new one (useful during development) +- Daemon runs in background; restart command handles cleanup automatically +- After making changes to audio/playback/daemon code, always restart the daemon to test changes + +## Code Conventions +- Use `directories` crate to resolve XDG paths (respect `XDG_CONFIG_HOME` and `XDG_RUNTIME_DIR` environment variables) +- Follow standard Rust style (enforced by `cargo fmt`) +- Never commit changes unless explicitly requested by the user +- Update shell completions when adding/modifying CLI subcommands +- Use `rand` crate for shuffle/randomization features (added in v0.9) + +## Task-Specific Guidelines +- **CLI changes**: Update clap subcommands (including `rsp scan` and `rsp settings`) and regenerate shell completion scripts +- **Database changes**: Update SQLite schema and `rsp scan` logic +- **Playback changes**: Modify daemon audio engine or queue management code + - Audio engine uses cpal for output and symphonia for decoding + - Queue system implemented in daemon.rs with `Queue` struct + - Sample buffering implemented to prevent buffer underruns - uses device default sample rate, not file's sample rate + - Pause/resume uses cpal stream `pause()`/`play()` methods +- **Scrobbling changes**: Update Last.fm/ListenBrainz client implementation +- **Config/Settings changes**: Update config schema, `rsp settings` subcommands, and scan interval/auto-scan logic + +## Completed Features (Phase 2) +- [x] Unix socket daemon IPC +- [x] Audio engine with play/pause/stop/volume +- [x] Queue system with in-memory tracking and auto-advance +- [x] Shuffle mode: `none`, `all`, and `album` (structure ready) implemented +- [x] Next/previous track commands with queue navigation +- [x] Resume CLI subcommand +- [x] Directory playback - queues all audio files in folder recursively +- [x] Fixed audio buffer underrun issues by using device default sample rate +- [x] Queue display with pager support (`rsplayer queue`) +- [x] Auto-play next track when current track ends + +## Remaining Work +- Album shuffle mode (`ShuffleMode::Album`) +- Database integration for queue persistence +- `rsplayer queue` command for queue management +- Scrobbling (Last.fm/ListenBrainz) +- Database scanning and schema +- Shell completion scripts +- Systemd service unit diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..1baedf3 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3135 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "alsa" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812947049edcd670a82cd5c73c3661d2e58468577ba8489de58e1a73c04cbd5d" +dependencies = [ + "alsa-sys", + "bitflags 2.11.1", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad7569085a265dd3f607ebecce7458eaab2132a84393534c95b18dcbc3f31e04" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "aws-lc-rs" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec6fb3fe69024a75fa7e1bfb48aa6cf59706a101658ea01bfd33b2b248a038f" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f50037ee5e1e41e7b8f9d161680a725bd1626cb6f8c7e901f91f942850852fe7" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "coreaudio-rs" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5d7dca3ebcf65a035582c9ad4385371a9d9ee6537474d2a278f4e1e475bb58" +dependencies = [ + "bitflags 2.11.1", + "libc", + "objc2-audio-toolbox", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", +] + +[[package]] +name = "cpal" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8942da362c0f0d895d7cac616263f2f9424edc5687364dfd1d25ef7eba506d7" +dependencies = [ + "alsa", + "coreaudio-rs", + "dasp_sample", + "jni 0.21.1", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "objc2", + "objc2-audio-toolbox", + "objc2-avf-audio", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows", +] + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "ctrlc" +version = "3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" +dependencies = [ + "dispatch2", + "nix", + "windows-sys 0.61.2", +] + +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.11.1", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "extended" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 5.3.0", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasip2", + "wasip3", +] + +[[package]] +name = "h2" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171fefbc92fe4a4de27e0698d6a5b392d6a0e333506bc49133760b3bcf948733" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "hashlink" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230" +dependencies = [ + "hashbrown 0.16.1", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.18", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libredox" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +dependencies = [ + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f111c8c41e7c61a49cd34e44c7619462967221a6443b0ec299e0ac30cfb9b1" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "mach2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.11.1", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nix" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d0705320c1e6ba1d912b5e37cf18071b6c2e9b7fa8215a1e8a7651966f5d3" +dependencies = [ + "bitflags 2.11.1", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-audio-toolbox" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08" +dependencies = [ + "bitflags 2.11.1", + "libc", + "objc2", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-avf-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" +dependencies = [ + "dispatch2", + "objc2", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-audio-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" +dependencies = [ + "bitflags 2.11.1", + "objc2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.11.1", + "block2", + "dispatch2", + "libc", + "objc2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.11.1", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.4", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "reqwest" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rsp" +version = "0.1.0" +dependencies = [ + "chrono", + "clap", + "cpal", + "ctrlc", + "directories", + "dirs", + "libc", + "rand 0.10.1", + "reqwest", + "rusqlite", + "serde", + "serde_json", + "symphonia", + "tokio", + "toml", +] + +[[package]] +name = "rsqlite-vfs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a1f2315036ef6b1fbacd1972e8ee7688030b0a2121edfc2a6550febd41574d" +dependencies = [ + "hashbrown 0.16.1", + "thiserror 2.0.18", +] + +[[package]] +name = "rusqlite" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2b0146dd9661bf67bb107c0bb2a55064d556eeb3fc314151b957f313bcd4e" +dependencies = [ + "bitflags 2.11.1", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", + "sqlite-wasm-rs", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni 0.22.4", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.11.1", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd_cesu8" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "sqlite-wasm-rs" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b2c760607300407ddeaee518acf28c795661b7108c75421303dbefb237d3a36" +dependencies = [ + "cc", + "js-sys", + "rsqlite-vfs", + "wasm-bindgen", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "symphonia" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" +dependencies = [ + "lazy_static", + "symphonia-bundle-flac", + "symphonia-bundle-mp3", + "symphonia-codec-aac", + "symphonia-codec-adpcm", + "symphonia-codec-alac", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-caf", + "symphonia-format-isomp4", + "symphonia-format-mkv", + "symphonia-format-ogg", + "symphonia-format-riff", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-flac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-codec-aac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-adpcm" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dddc50e2bbea4cfe027441eece77c46b9f319748605ab8f3443350129ddd07f" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-alac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8413fa754942ac16a73634c9dfd1500ed5c61430956b33728567f667fdd393ab" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-vorbis" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" +dependencies = [ + "log", + "symphonia-core", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-core" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-format-caf" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8faf379316b6b6e6bbc274d00e7a592e0d63ff1a7e182ce8ba25e24edd3d096" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-format-isomp4" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5" +dependencies = [ + "encoding_rs", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-mkv" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122d786d2c43a49beb6f397551b4a050d8229eaa54c7ddf9ee4b98899b8742d0" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-ogg" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-riff" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" +dependencies = [ + "extended", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-utils-xiph" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.11.1", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "110a78583f19d5cdb2c5ccf321d1290344e71313c6c37d43520d386027d18386" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.11+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.11.1", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.1", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31141ce3fc3e300ae89b78c0dd67f9708061d1d2eda54b8209346fd6be9a92c" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.1", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0ceee6f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "rsp" +version = "0.1.0" +edition = "2021" + +[dependencies] +clap = { version = "4.6.1", features = ["derive", "string"] } +rusqlite = { version = "0.39", features = ["bundled"] } +directories = "6.0" +serde = { version = "1.0.228", features = ["derive"] } +toml = "1.1.2" +tokio = { version = "1.52.2", features = ["full"] } +reqwest = { version = "0.13.3", features = ["json"] } +symphonia = { version = "0.5.5", features = ["all"] } +cpal = "0.17.3" +chrono = "0.4.44" +serde_json = "1.0.149" +dirs = "6.0" +libc = "0.2.186" +ctrlc = "3.5.2" +rand = "0.10.1" diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..98bd897 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,24 @@ +# rsplayer Project Plan + +## Phase 1: Setup & Core +1. Initialize Rust project, add dependencies: `clap` (CLI/autocompletion), `rusqlite` (SQLite), `symphonia`/`cpal` (audio), `directories` (XDG paths), `serde`/`toml` (config), `tokio` (daemon async), `reqwest` (scrobbling). +2. Config stored at `$XDG_CONFIG_HOME/rsplayer/config.toml`: `music_paths` (array of directories to scan), `scan_interval` (optional periodic rescan interval), scrobbling credentials, daemon socket path. Daemon auto-scans configured paths on first run if database is empty/missing. +3. SQLite library schema: `artists`, `albums`, `tracks` tables. Implement `rsp scan` to scan all paths in config's `music_paths`, populate/update database. Support `--force` full rescan, `--paths` override config paths. Auto-scan triggers on first run (if DB empty) and periodically per `scan_interval` config. + +## Phase 2: Daemon +1. Unix socket daemon (path: `$XDG_RUNTIME_DIR/rsplayer/daemon.sock`) for IPC. +2. Audio engine: Symphonia decode + CPAL output, support play/pause/stop/volume/seek. +3. Queue: in-memory, `last` (append to end, default), `now` (play immediately, ending current song playback), `next` (insert after current). +4. Shuffle modes: `none` (linear playback), `all` (shuffle all tracks), `album` (shuffle within album). +5. Scrobbling: Last.fm and ListenBrainz support via configured credentials. + +## Phase 3: CLI & Completion +1. Clap-based CLI with all subcommands. Generate shell completions for bash/zsh/fish, suggest database artists/albums/tracks, file paths, and config keys/values. +2. `rsp status`: show player state, current track, progress, volume, next 2-3 queue items. +3. `rsp queue`: no arguments display current queue; with arguments add items (default `last` behavior). +4. `rsp settings` subcommands: `get`, `set`, `list`, `unset` config values (music paths, scrobbling credentials, scan interval, etc.) without manual file editing. + +## Phase 4: Polish +1. Direct file/folder playback: prioritize database metadata if path matches known artist/album. +2. Logging, systemd service unit, unit tests. +3. Periodic rescan logic per config's `scan_interval`. diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..376841e --- /dev/null +++ b/TODO.md @@ -0,0 +1,51 @@ +# TODO + +## Completed ✓ + +- [x] **Fix SampleRate access in audio.rs:104** - `config.sample_rate().0` is invalid because `cpal::SampleRate` is a type alias for `u32`, not a tuple struct. + +- [x] **Implement previous track logic** (`src/playback.rs:99`) - Implemented basic previous() that restarts current track if playing/paused. + +- [x] **Remove unused std::thread import** (`src/playback.rs:2`) - Removed commented out import. + +- [x] **Run clippy** - All linting checks pass. + +- [x] **Run tests** - All tests pass (no tests exist yet). + +- [x] **Check formatting** - Code formatting is correct. + +- [x] **Implement resume functionality** - Implemented pause/resume using cpal stream pause()/play() methods. + +- [x] **Fix audio playback speed and buffer underrun** - Implemented proper sample buffering between callbacks to prevent audio skipping and buffer underrun errors. + +- [x] **Add Resume CLI subcommand** - Added `Resume` subcommand to CLI so users can resume playback after pause. + +- [x] **Implement shuffle mode** - Added shuffle on/off/album functionality with queue management in daemon. Supports `rsplayer shuffle on/off/album` commands. + +- [x] **Implement next/previous commands** - Next and previous track commands now work with the queue system. + +- [x] **Queue entire directory** - When playing a folder, all audio files are now queued instead of just the first one. + +- [x] **Auto-play next track** - Daemon automatically plays next track when current one ends (using `poll_track_ended()`). + +- [x] **Queue display with pager** - `rsplayer queue` shows all queued tracks with pager support for long lists. + +- [x] **Album shuffle mode structure** - `ShuffleMode::Album` added to enum and queue logic (behaves like `All` until database ready). + +## Potential Improvements + +- [ ] **Add error handling for audio playback** - Consider more robust error handling in the audio thread. + +- [ ] **Add unit tests for Player struct** - The `Player` struct in `playback.rs` has no corresponding tests. + +- [ ] **Persist queue state** - Save queue to disk so it survives daemon restarts. + +- [ ] **Album shuffle mode (database)** - Implement proper `ShuffleMode::Album` when database is ready (shuffle tracks within same album/folder). + +- [ ] **Scrobbling (Last.fm/ListenBrainz)** - Add scrobbling support via configured credentials. + +- [ ] **Database integration** - Scan music paths, populate SQLite database, use for metadata. + +- [ ] **Shell completion scripts** - Generate bash/zsh/fish completions using clap. + +- [ ] **Systemd service unit** - Create systemd service file for auto-start. diff --git a/src/audio.rs b/src/audio.rs new file mode 100644 index 0000000..86c88f7 --- /dev/null +++ b/src/audio.rs @@ -0,0 +1,418 @@ +use std::path::PathBuf; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::mpsc::{self, Receiver, Sender}; +use std::sync::{Arc, Mutex}; +use std::thread; + +#[allow(dead_code)] +pub enum AudioCommand { + Play(PathBuf), + Pause, + Resume, + Stop, + SetVolume(f32), +} + +pub struct AudioEngine { + command_tx: Sender, + is_playing: Arc, + current_track: Arc>>, + track_ended: Arc, +} + +impl AudioEngine { + pub fn new() -> Self { + let (tx, rx) = mpsc::channel(); + let is_playing = Arc::new(AtomicBool::new(false)); + let is_playing_clone = Arc::clone(&is_playing); + let current_track = Arc::new(Mutex::new(None)); + let current_track_clone = Arc::clone(¤t_track); + let track_ended = Arc::new(AtomicBool::new(false)); + let track_ended_clone = Arc::clone(&track_ended); + + let volume = Arc::new(Mutex::new(1.0f32)); + let volume_clone = Arc::clone(&volume); + + thread::spawn(move || { + audio_thread( + rx, + is_playing_clone, + current_track_clone, + volume_clone, + track_ended_clone, + ); + }); + + AudioEngine { + command_tx: tx, + is_playing, + current_track, + track_ended, + } + } + + pub fn play(&self, path: PathBuf) { + self.track_ended.store(false, Ordering::SeqCst); + if let Ok(mut track) = self.current_track.lock() { + *track = Some(path.clone()); + } + let _ = self.command_tx.send(AudioCommand::Play(path)); + } + + pub fn pause(&self) { + let _ = self.command_tx.send(AudioCommand::Pause); + } + + pub fn resume(&self) { + let _ = self.command_tx.send(AudioCommand::Resume); + } + + pub fn stop(&self) { + let _ = self.command_tx.send(AudioCommand::Stop); + } + + pub fn set_volume(&self, volume: f32) { + let _ = self.command_tx.send(AudioCommand::SetVolume(volume)); + } + + pub fn is_playing(&self) -> bool { + self.is_playing.load(Ordering::SeqCst) + } + + pub fn current_track(&self) -> Option { + self.current_track.lock().ok().and_then(|g| g.clone()) + } + + pub fn poll_track_ended(&self) -> bool { + self.track_ended.swap(false, Ordering::SeqCst) + } +} + +struct AudioData { + format: Box, + decoder: Box, + sample_rate: u32, + channels: u16, + sample_buffer: Vec, + buffer_pos: usize, + resample_ratio: Option, +} + +fn resample_linear(input: &[f32], ratio: f64, channels: usize) -> Vec { + if ratio == 1.0 { + return input.to_vec(); + } + let input_frames = input.len() / channels; + let output_frames = (input_frames as f64 * ratio).ceil() as usize; + let mut output = Vec::with_capacity(output_frames * channels); + for i in 0..output_frames { + let input_pos = i as f64 / ratio; + let idx = input_pos.floor() as usize; + let frac = input_pos.fract() as f32; + for ch in 0..channels { + let cur = if idx * channels + ch < input.len() { + input[idx * channels + ch] + } else { + 0.0 + }; + let next = if (idx + 1) * channels + ch < input.len() { + input[(idx + 1) * channels + ch] + } else { + cur + }; + output.push(cur + frac * (next - cur)); + } + } + output +} + +fn audio_thread( + rx: Receiver, + is_playing: Arc, + current_track: Arc>>, + volume: Arc>, + track_ended: Arc, +) { + use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; + + let host = cpal::default_host(); + let device = match host.default_output_device() { + Some(d) => d, + None => { + eprintln!("No output device available"); + return; + } + }; + + let config = match device.default_output_config() { + Ok(c) => c, + Err(e) => { + eprintln!("Failed to get output config: {}", e); + return; + } + }; + + let device_sample_rate = config.sample_rate(); + let channels = config.channels(); + eprintln!( + "Default output: {} Hz, {} channels", + device_sample_rate, channels + ); + + let mut current_stream: Option = None; + let audio_data: Arc>> = Arc::new(Mutex::new(None)); + + while let Ok(cmd) = rx.recv() { + match cmd { + AudioCommand::Play(path) => { + is_playing.store(true, Ordering::SeqCst); + if let Ok(mut track) = current_track.lock() { + *track = Some(path.clone()); + } + + // Drop the current stream before creating a new one + current_stream = None; + + match open_audio_file(&path) { + Ok(mut data) => { + eprintln!("File: {} Hz, {} channels", data.sample_rate, data.channels); + + if data.sample_rate != device_sample_rate { + eprintln!( + "Resampling from {} Hz to {} Hz", + data.sample_rate, device_sample_rate + ); + data.resample_ratio = + Some(device_sample_rate as f64 / data.sample_rate as f64); + } + + let stream_config: cpal::StreamConfig = + device.default_output_config().unwrap().into(); + + let audio_data_clone = Arc::clone(&audio_data); + let vol = Arc::clone(&volume); + let ended = Arc::clone(&track_ended); + let is_playing_clone = Arc::clone(&is_playing); + + if let Ok(mut d) = audio_data.lock() { + *d = Some(data); + } + + match device.build_output_stream( + &stream_config, + move |data: &mut [f32], _: &cpal::OutputCallbackInfo| { + let vol = vol.lock().map(|v| *v).unwrap_or(1.0); + + if let Ok(mut audio_data) = audio_data_clone.lock() { + if let Some(ref mut state) = *audio_data { + let channels = state.channels as usize; + let mut offset = 0usize; + + // Keep decoding until we fill the buffer or run out of data + while offset < data.len() { + // First, copy any buffered samples + if state.buffer_pos < state.sample_buffer.len() { + let remaining = + &state.sample_buffer[state.buffer_pos..]; + let to_copy = + remaining.len().min(data.len() - offset); + data[offset..offset + to_copy] + .copy_from_slice(&remaining[..to_copy]); + state.buffer_pos += to_copy; + offset += to_copy; + + // If we've consumed all buffered samples, clear the buffer + if state.buffer_pos >= state.sample_buffer.len() { + state.sample_buffer.clear(); + state.buffer_pos = 0; + } + continue; // Try to fill more of the buffer + } + + // Decode more data + match state.format.next_packet() { + Ok(packet) => { + match state.decoder.decode(&packet) { + Ok(decoded) => { + let spec = *decoded.spec(); + let mut sample_buf = + symphonia::core::audio::SampleBuffer::< + f32, + >::new( + decoded.capacity() as u64, spec + ); + sample_buf + .copy_interleaved_ref(decoded); + let samples = sample_buf.samples(); + + // Resample if needed + let resampled = if let Some(ratio) = + state.resample_ratio + { + resample_linear( + samples, ratio, channels, + ) + } else { + samples.to_vec() + }; + + // Copy what we can to output + let to_copy = resampled + .len() + .min(data.len() - offset); + data[offset..offset + to_copy] + .copy_from_slice( + &resampled[..to_copy], + ); + offset += to_copy; + + // Buffer the rest + if to_copy < resampled.len() { + state.sample_buffer.clear(); + state + .sample_buffer + .extend_from_slice( + &resampled[to_copy..], + ); + state.buffer_pos = 0; + } + } + Err(_) => break, + } + } + Err(_) => break, + } + } + + // Apply volume + for sample in data.iter_mut().take(offset) { + *sample *= vol; + } + + // Fill remaining with silence + for sample in data.iter_mut().skip(offset) { + *sample = 0.0; + } + + // If no more data and offset is 0, track ended + if offset == 0 && state.sample_buffer.is_empty() { + ended.store(true, Ordering::SeqCst); + is_playing_clone.store(false, Ordering::SeqCst); + // Clear audio data so we don't keep triggering ended + if let Ok(mut audio_data) = audio_data_clone.lock() { + *audio_data = None; + } + } + } else { + for sample in data.iter_mut() { + *sample = 0.0; + } + } + } + }, + |err| { + eprintln!("Stream error: {}", err); + }, + None, + ) { + Ok(stream) => { + if let Err(e) = stream.play() { + eprintln!("Failed to start stream: {}", e); + is_playing.store(false, Ordering::SeqCst); + track_ended.store(true, Ordering::SeqCst); + } else { + current_stream = Some(stream); + } + } + Err(e) => { + eprintln!("Failed to create stream: {}", e); + is_playing.store(false, Ordering::SeqCst); + track_ended.store(true, Ordering::SeqCst); + } + } + } + Err(e) => { + eprintln!("Failed to open audio: {}", e); + is_playing.store(false, Ordering::SeqCst); + track_ended.store(true, Ordering::SeqCst); + } + } + } + AudioCommand::Pause => { + if let Some(ref stream) = current_stream { + if let Err(e) = stream.pause() { + eprintln!("Failed to pause stream: {}", e); + } + is_playing.store(false, Ordering::SeqCst); + } + } + AudioCommand::Resume => { + if let Some(ref stream) = current_stream { + if let Err(e) = stream.play() { + eprintln!("Failed to resume stream: {}", e); + } else { + is_playing.store(true, Ordering::SeqCst); + } + } + } + AudioCommand::Stop => { + current_stream = None; + if let Ok(mut d) = audio_data.lock() { + *d = None; + } + is_playing.store(false, Ordering::SeqCst); + if let Ok(mut track) = current_track.lock() { + *track = None; + } + } + AudioCommand::SetVolume(vol) => { + if let Ok(mut volume_ref) = volume.lock() { + *volume_ref = vol; + } + } + } + } +} + +fn open_audio_file(path: &PathBuf) -> Result> { + use symphonia::core::audio::Channels; + use symphonia::core::io::MediaSourceStream; + + let file = std::fs::File::open(path)?; + let mss = MediaSourceStream::new(Box::new(file), Default::default()); + + let hint = symphonia::core::probe::Hint::new(); + let probed = symphonia::default::get_probe().format( + &hint, + mss, + &Default::default(), + &Default::default(), + )?; + + let format = probed.format; + let track = format + .tracks() + .iter() + .find(|t| t.codec_params.sample_rate.is_some()) + .ok_or("No suitable track found")?; + + let sample_rate = track.codec_params.sample_rate.unwrap_or(44100); + let channels = track + .codec_params + .channels + .unwrap_or(Channels::FRONT_LEFT | Channels::FRONT_RIGHT) + .count() as u16; + + let decoder = + symphonia::default::get_codecs().make(&track.codec_params, &Default::default())?; + + Ok(AudioData { + format, + decoder, + sample_rate, + channels, + sample_buffer: Vec::new(), + buffer_pos: 0, + resample_ratio: None, + }) +} diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..13ef67c --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,186 @@ +use crate::config::Config; +use crate::database::Database; +use clap::{Parser, Subcommand}; +use std::path::PathBuf; + +#[derive(Parser)] +#[command(name = "rsp")] +#[command(about = "Rust music player daemon", long_about = None)] +pub struct Cli { + #[command(subcommand)] + pub command: Commands, +} + +#[derive(Subcommand)] +pub enum Commands { + /// Start the daemon + Start, + /// Stop the daemon + Stop, + /// Restart the daemon (kill existing and start new) + Restart, + /// Play a track, album, or artist + Play { + #[arg(value_name = "QUERY")] + query: Option, + }, + /// Pause playback + Pause, + /// Resume playback + Resume, + /// Stop playback + StopPlayback, + /// Skip to next track + Next, + /// Skip to previous track + Previous, + /// Set volume (0-100) + Volume { + #[arg(value_name = "LEVEL")] + level: Option, + }, + /// Shuffle mode + Shuffle { + #[arg(value_name = "MODE")] + mode: Option, + }, + /// Queue management + Queue { + #[arg(value_name = "POSITION")] + position: Option, + #[arg(value_name = "QUERY")] + query: Option, + }, + /// Show player status + Status, + /// Scan music paths to populate database + Scan { + #[arg(long)] + force: bool, + #[arg(long, value_name = "PATHS")] + paths: Option>, + }, + /// Settings management + Settings { + #[command(subcommand)] + command: SettingsCommands, + }, +} + +#[derive(Subcommand)] +pub enum SettingsCommands { + /// Get a setting value + Get { + #[arg(value_name = "KEY")] + key: String, + }, + /// Set a setting value + Set { + #[arg(value_name = "KEY")] + key: String, + #[arg(value_name = "VALUE")] + value: String, + }, + /// List all settings + List, + /// Unset a setting + Unset { + #[arg(value_name = "KEY")] + key: String, + }, +} + +impl Cli { + pub fn run(&self) -> Result<(), Box> { + match &self.command { + Commands::Start => { + crate::daemon::start_daemon()?; + } + Commands::Stop => { + crate::daemon::stop_daemon()?; + } + Commands::Restart => { + crate::daemon::restart_daemon()?; + } + Commands::Play { query } => { + if let Some(q) = query { + crate::daemon::send_command(format!("play {}", q))?; + } else { + crate::daemon::send_command("play".to_string())?; + } + } + Commands::Pause => { + crate::daemon::send_command("pause".to_string())?; + } + Commands::Resume => { + crate::daemon::send_command("resume".to_string())?; + } + Commands::StopPlayback => { + crate::daemon::send_command("stop".to_string())?; + } + Commands::Next => { + crate::daemon::send_command("next".to_string())?; + } + Commands::Previous => { + crate::daemon::send_command("previous".to_string())?; + } + Commands::Volume { level } => { + if let Some(l) = level { + crate::daemon::send_command(format!("volume {}", l))?; + } else { + crate::daemon::send_command("volume".to_string())?; + } + } + Commands::Shuffle { mode } => { + if let Some(m) = mode { + crate::daemon::send_command(format!("shuffle {}", m))?; + } else { + crate::daemon::send_command("shuffle".to_string())?; + } + } + Commands::Queue { position, query } => match (position, query) { + (None, None) => { + crate::daemon::send_command("queue".to_string())?; + } + (pos, Some(q)) => { + let pos = pos.as_deref().unwrap_or("last"); + crate::daemon::send_command(format!("queue {} {}", pos, q))?; + } + _ => {} + }, + Commands::Status => { + crate::daemon::send_command("status".to_string())?; + } + Commands::Scan { force, paths } => { + let config = Config::load()?; + let db = Database::open(&config)?; + if let Some(custom_paths) = paths { + db.scan_paths(custom_paths, *force)?; + } else { + db.scan_paths(&config.music_paths, *force)?; + } + println!("Scan complete"); + } + Commands::Settings { command } => { + let mut config = Config::load()?; + match command { + SettingsCommands::Get { key } => { + println!("{}", config.get(key)?); + } + SettingsCommands::Set { key, value } => { + config.set(key, value)?; + config.save()?; + } + SettingsCommands::List => { + config.list(); + } + SettingsCommands::Unset { key } => { + config.unset(key)?; + config.save()?; + } + } + } + } + Ok(()) + } +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..cda59f4 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,180 @@ +use directories::ProjectDirs; +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::PathBuf; + +#[derive(Debug, Serialize, Deserialize, Default)] +pub struct Config { + #[serde(skip)] + pub config_path: PathBuf, + pub music_paths: Vec, + pub scan_interval: Option, + pub socket_path: Option, + pub lastfm_api_key: Option, + pub lastfm_api_secret: Option, + pub lastfm_session_key: Option, + pub listenbrainz_token: Option, + pub volume: Option, + pub shuffle: Option, +} + +impl Config { + pub fn load() -> Result> { + let proj_dirs = ProjectDirs::from("com", "rsplayer", "rsplayer") + .ok_or("Failed to get project directories")?; + + let config_dir = if let Ok(xdg) = std::env::var("XDG_CONFIG_HOME") { + PathBuf::from(xdg).join("rsplayer") + } else { + proj_dirs.config_dir().to_path_buf() + }; + + let config_path = config_dir.join("config.toml"); + + if !config_path.exists() { + fs::create_dir_all(&config_dir)?; + let default = Self { + config_path: config_path.clone(), + music_paths: vec![dirs::audio_dir().unwrap_or_else(|| PathBuf::from("~/Music"))], + scan_interval: Some(3600), + socket_path: None, + ..Default::default() + }; + default.save()?; + return Ok(default); + } + + let content = fs::read_to_string(&config_path)?; + let mut config: Self = toml::from_str(&content)?; + config.config_path = config_path; + Ok(config) + } + + pub fn save(&self) -> Result<(), Box> { + let content = toml::to_string_pretty(self)?; + if let Some(parent) = self.config_path.parent() { + fs::create_dir_all(parent)?; + } + fs::write(&self.config_path, content)?; + Ok(()) + } + + pub fn get(&self, key: &str) -> Result> { + match key { + "music_paths" => Ok(self + .music_paths + .iter() + .map(|p| p.display().to_string()) + .collect::>() + .join(", ")), + "scan_interval" => Ok(self + .scan_interval + .map(|i| i.to_string()) + .unwrap_or_else(|| "not set".to_string())), + "socket_path" => Ok(self + .socket_path + .as_ref() + .map(|p| p.display().to_string()) + .unwrap_or_else(|| "default".to_string())), + "lastfm_api_key" => Ok(self + .lastfm_api_key + .clone() + .unwrap_or_else(|| "not set".to_string())), + "lastfm_api_secret" => Ok(self + .lastfm_api_secret + .clone() + .unwrap_or_else(|| "not set".to_string())), + "lastfm_session_key" => Ok(self + .lastfm_session_key + .clone() + .unwrap_or_else(|| "not set".to_string())), + "listenbrainz_token" => Ok(self + .listenbrainz_token + .clone() + .unwrap_or_else(|| "not set".to_string())), + "volume" => Ok(self + .volume + .map(|v| v.to_string()) + .unwrap_or_else(|| "not set".to_string())), + "shuffle" => Ok(self.shuffle.clone().unwrap_or_else(|| "off".to_string())), + _ => Err(format!("Unknown setting: {}", key).into()), + } + } + + pub fn set(&mut self, key: &str, value: &str) -> Result<(), Box> { + match key { + "music_paths" => { + self.music_paths = value.split(',').map(|p| PathBuf::from(p.trim())).collect(); + } + "scan_interval" => { + self.scan_interval = Some(value.parse()?); + } + "socket_path" => { + self.socket_path = Some(PathBuf::from(value)); + } + "lastfm_api_key" => { + self.lastfm_api_key = Some(value.to_string()); + } + "lastfm_api_secret" => { + self.lastfm_api_secret = Some(value.to_string()); + } + "lastfm_session_key" => { + self.lastfm_session_key = Some(value.to_string()); + } + "listenbrainz_token" => { + self.listenbrainz_token = Some(value.to_string()); + } + "volume" => { + self.volume = Some(value.parse()?); + } + "shuffle" => { + if value == "on" || value == "all" || value == "album" { + self.shuffle = Some(value.to_string()); + } else if value == "off" || value == "none" { + self.shuffle = None; + } else { + return Err(format!("Invalid shuffle value: {}", value).into()); + } + } + _ => return Err(format!("Unknown setting: {}", key).into()), + } + Ok(()) + } + + pub fn list(&self) { + println!("music_paths = {:?}", self.music_paths); + println!("scan_interval = {:?}", self.scan_interval); + println!("socket_path = {:?}", self.socket_path); + println!("lastfm_api_key = {:?}", self.lastfm_api_key); + println!("lastfm_api_secret = {:?}", self.lastfm_api_secret); + println!("lastfm_session_key = {:?}", self.lastfm_session_key); + println!("listenbrainz_token = {:?}", self.listenbrainz_token); + println!("volume = {:?}", self.volume); + println!("shuffle = {:?}", self.shuffle); + } + + pub fn unset(&mut self, key: &str) -> Result<(), Box> { + match key { + "music_paths" => self.music_paths.clear(), + "scan_interval" => self.scan_interval = None, + "socket_path" => self.socket_path = None, + "lastfm_api_key" => self.lastfm_api_key = None, + "lastfm_api_secret" => self.lastfm_api_secret = None, + "lastfm_session_key" => self.lastfm_session_key = None, + "listenbrainz_token" => self.listenbrainz_token = None, + "volume" => self.volume = None, + "shuffle" => self.shuffle = None, + _ => return Err(format!("Unknown setting: {}", key).into()), + } + Ok(()) + } + + pub fn get_socket_path(&self) -> PathBuf { + self.socket_path.clone().unwrap_or_else(|| { + let runtime_dir = std::env::var("XDG_RUNTIME_DIR") + .map(PathBuf::from) + .unwrap_or_else(|_| PathBuf::from("/tmp")); + runtime_dir.join("rsplayer").join("daemon.sock") + }) + } +} diff --git a/src/daemon.rs b/src/daemon.rs new file mode 100644 index 0000000..8ac3a89 --- /dev/null +++ b/src/daemon.rs @@ -0,0 +1,574 @@ +use crate::audio::AudioEngine; +use crate::config::Config; +use std::io::{Read, Write}; +use std::os::unix::net::{UnixListener, UnixStream}; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Mutex}; +use std::thread; +use std::time::Duration; + +#[derive(Debug, Clone)] +enum ShuffleMode { + None, + All, + Album, +} + +struct Queue { + tracks: Vec, + position: usize, + shuffle: ShuffleMode, + shuffled_indices: Vec, +} + +impl Queue { + fn new() -> Self { + Queue { + tracks: Vec::new(), + position: 0, + shuffle: ShuffleMode::None, + shuffled_indices: Vec::new(), + } + } + + fn add_track(&mut self, path: PathBuf) { + self.tracks.push(path); + self.update_shuffle_indices(); + } + + fn set_shuffle(&mut self, mode: ShuffleMode) { + self.shuffle = mode.clone(); + self.update_shuffle_indices(); + } + + fn update_shuffle_indices(&mut self) { + self.shuffled_indices = (0..self.tracks.len()).collect(); + if let ShuffleMode::All = self.shuffle { + use rand::seq::SliceRandom; + let mut rng = rand::rng(); + self.shuffled_indices.shuffle(&mut rng); + } + } + + fn current(&self) -> Option<&PathBuf> { + if self.tracks.is_empty() { + None + } else if let ShuffleMode::All = self.shuffle { + self.shuffled_indices + .get(self.position) + .and_then(|&idx| self.tracks.get(idx)) + } else if let ShuffleMode::Album = self.shuffle { + // TODO: When database is ready, only shuffle tracks in same album/folder + // For now, behave like All + self.shuffled_indices + .get(self.position) + .and_then(|&idx| self.tracks.get(idx)) + } else { + self.tracks.get(self.position) + } + } + + fn next(&mut self) -> Option { + let max_pos = self.tracks.len().saturating_sub(1); + if self.position < max_pos { + self.position += 1; + self.current().cloned() + } else { + None + } + } + + fn previous(&mut self) -> Option { + if self.position > 0 { + self.position -= 1; + self.current().cloned() + } else { + None + } + } +} + +pub fn start_daemon() -> Result<(), Box> { + let config = Config::load()?; + let socket_path = config.get_socket_path(); + let pid_path = get_pid_path(&config); + + // Check if daemon is already running + if let Ok(pid) = check_running_daemon(&pid_path) { + return Err(format!("Daemon already running with PID {}", pid).into()); + } + + // Clean up stale socket file if it exists + if socket_path.exists() { + std::fs::remove_file(&socket_path).ok(); + } + + // Create runtime directory + if let Some(parent) = socket_path.parent() { + std::fs::create_dir_all(parent)?; + } + if let Some(parent) = pid_path.parent() { + std::fs::create_dir_all(parent)?; + } + + // Write PID file + let pid = std::process::id(); + std::fs::write(&pid_path, pid.to_string())?; + println!("Daemon started with PID {}", pid); + + // Shared shutdown flag - can be triggered by signal or command + let shutdown_flag = Arc::new(AtomicBool::new(false)); + let shutdown_flag_signal = Arc::clone(&shutdown_flag); + + // Handle SIGTERM and SIGINT + ctrlc::set_handler(move || { + println!("Received shutdown signal"); + shutdown_flag_signal.store(true, Ordering::SeqCst); + })?; + + let listener = UnixListener::bind(&socket_path)?; + println!("Listening on {:?}", socket_path); + + let audio_engine = Arc::new(AudioEngine::new()); + let queue = Arc::new(Mutex::new(Queue::new())); + + // Load and apply saved settings + let config = Config::load().unwrap_or_default(); + if let Some(vol) = config.volume { + audio_engine.set_volume(vol as f32 / 100.0); + } + if let Some(ref shuffle_str) = config.shuffle { + if let Ok(mut q) = queue.lock() { + match shuffle_str.as_str() { + "on" | "all" => q.set_shuffle(ShuffleMode::All), + "album" => q.set_shuffle(ShuffleMode::Album), + _ => {} + } + } + } + + // Accept connections until shutdown + listener.set_nonblocking(true)?; + loop { + // Check for shutdown signal + if shutdown_flag.load(Ordering::SeqCst) { + break; + } + + // Check if track ended and play next + if audio_engine.poll_track_ended() { + if let Ok(mut q) = queue.lock() { + if let Some(next_track) = q.next() { + audio_engine.play(next_track); + } else { + audio_engine.stop(); + } + } + } + + match listener.accept() { + Ok((stream, _)) => { + let audio_clone = Arc::clone(&audio_engine); + let shutdown_flag_clone = Arc::clone(&shutdown_flag); + let queue_clone = Arc::clone(&queue); + thread::spawn(move || { + handle_client(stream, audio_clone, shutdown_flag_clone, queue_clone); + }); + } + Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => { + thread::sleep(Duration::from_millis(50)); + continue; + } + Err(e) => eprintln!("Connection failed: {}", e), + } + + thread::sleep(Duration::from_millis(50)); + } + + // Cleanup + cleanup_daemon(&socket_path, &pid_path); + println!("Daemon stopped"); + Ok(()) +} + +pub fn stop_daemon() -> Result<(), Box> { + let config = Config::load()?; + let pid_path = get_pid_path(&config); + + match check_running_daemon(&pid_path) { + Ok(pid) => { + // Try to send stop command first for graceful shutdown + if let Ok(()) = send_command_raw("stop_daemon".to_string()) { + // Wait for daemon to stop + for _ in 0..50 { + thread::sleep(Duration::from_millis(100)); + if !is_process_running(pid) { + break; + } + } + } + + // Force kill if still running + if is_process_running(pid) { + unsafe { + libc::kill(pid as i32, libc::SIGTERM); + } + thread::sleep(Duration::from_millis(500)); + + // Force kill if still alive + if is_process_running(pid) { + unsafe { + libc::kill(pid as i32, libc::SIGKILL); + } + } + } + + // Clean up files + let socket_path = config.get_socket_path(); + std::fs::remove_file(&socket_path).ok(); + std::fs::remove_file(&pid_path).ok(); + + println!("Daemon stopped"); + Ok(()) + } + Err(e) => Err(format!("Daemon not running: {}", e).into()), + } +} + +pub fn restart_daemon() -> Result<(), Box> { + // Stop existing daemon + if let Ok(()) = stop_daemon() { + // Wait a bit for cleanup + thread::sleep(Duration::from_millis(500)); + } + + // Start new daemon in background + let current_exe = std::env::current_exe()?; + std::process::Command::new(current_exe) + .arg("start") + .spawn()?; + + println!("Daemon restarted"); + Ok(()) +} + +pub fn send_command(cmd: String) -> Result<(), Box> { + send_command_raw(cmd)?; + Ok(()) +} + +fn send_command_raw(cmd: String) -> Result<(), Box> { + let config = Config::load()?; + let socket_path = config.get_socket_path(); + + let mut stream = UnixStream::connect(socket_path)?; + stream.write_all(cmd.as_bytes())?; + + let mut response = String::new(); + stream.read_to_string(&mut response)?; + print!("{}", response); + + Ok(()) +} + +fn handle_client( + mut stream: UnixStream, + audio: Arc, + shutdown_flag: Arc, + queue: Arc>, +) { + let mut buffer = [0; 1024]; + if let Ok(size) = stream.read(&mut buffer) { + let cmd = String::from_utf8_lossy(&buffer[..size]); + let response = process_command(cmd.trim(), &audio, &shutdown_flag, &queue); + let _ = stream.write_all(response.as_bytes()); + } +} + +fn process_command( + cmd: &str, + audio: &AudioEngine, + shutdown_flag: &Arc, + queue: &Arc>, +) -> String { + match cmd { + "status" => { + if audio.is_playing() { + if let Some(track) = audio.current_track() { + format!("Playing\nTrack: {}\n", track.display()) + } else { + "Playing\n".to_string() + } + } else { + "Stopped\n".to_string() + } + } + "pause" => { + audio.pause(); + "Paused\n".to_string() + } + "resume" => { + audio.resume(); + "Resumed\n".to_string() + } + "stop" => { + audio.stop(); + // Clear queue on stop + if let Ok(mut q) = queue.lock() { + q.tracks.clear(); + q.position = 0; + } + "Stopped\n".to_string() + } + "stop_daemon" => { + // Signal the daemon to shut down + shutdown_flag.store(true, Ordering::SeqCst); + "Shutting down\n".to_string() + } + "next" => { + if let Ok(mut q) = queue.lock() { + if let Some(next_track) = q.next() { + audio.play(next_track); + "Playing next track\n".to_string() + } else { + audio.stop(); + "Queue empty, stopped\n".to_string() + } + } else { + "Error accessing queue\n".to_string() + } + } + "previous" => { + if let Ok(mut q) = queue.lock() { + if let Some(prev_track) = q.previous() { + audio.play(prev_track); + "Playing previous track\n".to_string() + } else { + "No previous track\n".to_string() + } + } else { + "Error accessing queue\n".to_string() + } + } + "shuffle" => { + if let Ok(q) = queue.lock() { + match q.shuffle { + ShuffleMode::None => "Shuffle: off\n".to_string(), + ShuffleMode::All => "Shuffle: on (all)\n".to_string(), + ShuffleMode::Album => "Shuffle: on (album)\n".to_string(), + } + } else { + "Error accessing queue\n".to_string() + } + } + _ if cmd.starts_with("shuffle ") => { + let mode_str = cmd[8..].trim(); + if let Ok(mut q) = queue.lock() { + let result = if mode_str == "on" || mode_str == "all" { + q.set_shuffle(ShuffleMode::All); + "Shuffle: on (all)\n".to_string() + } else if mode_str == "album" { + q.set_shuffle(ShuffleMode::Album); + "Shuffle: on (album)\n".to_string() + } else if mode_str == "off" || mode_str == "none" { + q.set_shuffle(ShuffleMode::None); + "Shuffle: off\n".to_string() + } else { + "Usage: shuffle [on|off|album]\n".to_string() + }; + // Save to config + if let Ok(mut config) = Config::load() { + if mode_str == "off" || mode_str == "none" { + config.shuffle = None; + } else { + config.shuffle = Some(mode_str.to_string()); + } + let _ = config.save(); + } + result + } else { + "Error accessing queue\n".to_string() + } + } + _ if cmd.starts_with("play ") => { + let path_str = &cmd[5..].trim(); + let path = std::path::PathBuf::from(path_str); + if path.is_file() { + // Add to queue and play + if let Ok(mut q) = queue.lock() { + q.add_track(path.clone()); + } + audio.play(path); + format!("Playing: {}\n", path_str) + } else if path.is_dir() { + // Find all audio files in directory + match find_audio_in_dir(&path) { + Some(files) if !files.is_empty() => { + if let Ok(mut q) = queue.lock() { + for file in &files { + q.add_track(file.clone()); + } + // If shuffle is on, shuffled_indices is already set + // Play the first track from the shuffled list + if let Some(track) = q.current().cloned() { + audio.play(track); + } + } + format!("Queued {} tracks from: {}\n", files.len(), path_str) + } + _ => format!("Error: No audio files found in '{}'\n", path_str), + } + } else { + format!("File not found: {}\n", path_str) + } + } + _ if cmd.starts_with("volume ") => { + if let Ok(level) = cmd[7..].trim().parse::() { + audio.set_volume(level as f32 / 100.0); + // Save to config + if let Ok(mut config) = Config::load() { + config.volume = Some(level); + let _ = config.save(); + } + format!("Volume set to {}\n", level) + } else { + "Usage: volume <0-100>\n".to_string() + } + } + _ if cmd.starts_with("shuffle ") => { + let mode_str = cmd[8..].trim(); + if let Ok(mut q) = queue.lock() { + if mode_str == "on" || mode_str == "all" { + q.set_shuffle(ShuffleMode::All); + "Shuffle: on\n".to_string() + } else if mode_str == "off" || mode_str == "none" { + q.set_shuffle(ShuffleMode::None); + "Shuffle: off\n".to_string() + } else { + "Usage: shuffle [on|off]\n".to_string() + } + } else { + "Error accessing queue\n".to_string() + } + } + _ if cmd.starts_with("queue") => { + if let Ok(q) = queue.lock() { + if q.tracks.is_empty() { + "Queue is empty\n".to_string() + } else { + let mut output = String::new(); + let current_position = q.position; + // Use shuffled_indices for display order if shuffle is on + let indices: Vec = if let ShuffleMode::None = q.shuffle { + (0..q.tracks.len()).collect() + } else { + q.shuffled_indices.clone() + }; + for (display_idx, &track_idx) in indices.iter().enumerate() { + if let Some(track) = q.tracks.get(track_idx) { + if display_idx == current_position { + output.push_str(&format!("> {} (playing)\n", track.display())); + } else { + output.push_str(&format!(" {}\n", track.display())); + } + } + } + // Use pager if output is long (more than 24 lines) + if output.lines().count() > 24 { + use std::process::{Command, Stdio}; + let pager = Command::new("less").arg("-R").stdin(Stdio::piped()).spawn(); + if let Ok(mut child) = pager { + use std::io::Write; + let _ = child.stdin.as_mut().unwrap().write_all(output.as_bytes()); + let _ = child.wait(); + "".to_string() + } else { + output + } + } else { + output + } + } + } else { + "Error accessing queue\n".to_string() + } + } + _ => "Unknown command\n".to_string(), + } +} + +fn find_audio_in_dir(dir: &Path) -> Option> { + use std::ffi::OsStr; + + let mut results = Vec::new(); + + if let Ok(entries) = std::fs::read_dir(dir) { + let mut entries: Vec<_> = entries.filter_map(|e| e.ok()).collect(); + entries.sort_by_key(|e| e.file_name()); + + for entry in entries { + let path = entry.path(); + if path.is_file() { + if let Some(ext) = path.extension().and_then(OsStr::to_str) { + if matches!( + ext.to_lowercase().as_str(), + "mp3" | "flac" | "ogg" | "m4a" | "wav" | "opus" + ) { + results.push(path); + } + } + } else if path.is_dir() { + if let Some(mut found) = find_audio_in_dir(&path) { + results.append(&mut found); + } + } + } + } + + if results.is_empty() { + None + } else { + Some(results) + } +} + +/// Get the PID file path for the daemon +fn get_pid_path(_config: &Config) -> std::path::PathBuf { + let runtime_dir = std::env::var("XDG_RUNTIME_DIR") + .map(std::path::PathBuf::from) + .unwrap_or_else(|_| std::path::PathBuf::from("/tmp")); + runtime_dir.join("rsplayer").join("rsplayer.pid") +} + +/// Check if a process with the given PID is running +fn is_process_running(pid: u32) -> bool { + unsafe { + // send signal 0 to check if process exists + libc::kill(pid as i32, 0) == 0 + } +} + +/// Check if daemon is running by reading PID file +fn check_running_daemon(pid_path: &std::path::Path) -> Result> { + if !pid_path.exists() { + return Err("PID file not found".into()); + } + + let contents = std::fs::read_to_string(pid_path)?; + let pid = contents.trim().parse::()?; + + if is_process_running(pid) { + Ok(pid) + } else { + // Stale PID file, clean it up + std::fs::remove_file(pid_path).ok(); + Err("Stale PID file, daemon not running".into()) + } +} + +/// Clean up daemon resources (socket and PID file) +fn cleanup_daemon(socket_path: &std::path::Path, pid_path: &std::path::Path) { + std::fs::remove_file(socket_path).ok(); + std::fs::remove_file(pid_path).ok(); +} diff --git a/src/database.rs b/src/database.rs new file mode 100644 index 0000000..9d1d5f2 --- /dev/null +++ b/src/database.rs @@ -0,0 +1,259 @@ +use directories::ProjectDirs; +use rusqlite::{Connection, Result as SqlResult}; +use std::fs; +use std::path::{Path, PathBuf}; +use std::time::SystemTime; + +#[derive(Debug, Clone)] +#[allow(dead_code)] +pub struct Artist { + pub id: i64, + pub name: String, +} + +#[derive(Debug, Clone)] +#[allow(dead_code)] +pub struct Album { + pub id: i64, + pub artist_id: i64, + pub title: String, +} + +#[derive(Debug, Clone)] +#[allow(dead_code)] +pub struct Track { + pub id: i64, + pub album_id: i64, + pub title: String, + pub path: PathBuf, + pub duration: Option, + pub track_number: Option, + pub artist_name: Option, + pub album_title: Option, +} + +pub struct Database { + conn: Connection, +} + +#[allow(dead_code)] +impl Database { + pub fn open(_config: &crate::config::Config) -> SqlResult { + let proj_dirs = ProjectDirs::from("com", "rsplayer", "rsplayer").ok_or_else(|| { + rusqlite::Error::InvalidPath("Failed to get project directories".into()) + })?; + + let data_dir = if let Ok(xdg) = std::env::var("XDG_CONFIG_HOME") { + PathBuf::from(xdg).join("rsplayer") + } else { + proj_dirs.data_dir().to_path_buf() + }; + + fs::create_dir_all(&data_dir).ok(); + let db_path = data_dir.join("library.db"); + + let conn = Connection::open(&db_path)?; + let db = Database { conn }; + db.init_schema()?; + Ok(db) + } + + fn init_schema(&self) -> SqlResult<()> { + self.conn.execute( + "CREATE TABLE IF NOT EXISTS artists ( + id INTEGER PRIMARY KEY, + name TEXT UNIQUE NOT NULL + )", + [], + )?; + + self.conn.execute( + "CREATE TABLE IF NOT EXISTS albums ( + id INTEGER PRIMARY KEY, + artist_id INTEGER NOT NULL, + title TEXT NOT NULL, + FOREIGN KEY (artist_id) REFERENCES artists(id), + UNIQUE(artist_id, title) + )", + [], + )?; + + self.conn.execute( + "CREATE TABLE IF NOT EXISTS tracks ( + id INTEGER PRIMARY KEY, + album_id INTEGER NOT NULL, + title TEXT NOT NULL, + path TEXT UNIQUE NOT NULL, + duration INTEGER, + track_number INTEGER, + last_scanned INTEGER, + FOREIGN KEY (album_id) REFERENCES albums(id) + )", + [], + )?; + + Ok(()) + } + + pub fn scan_paths(&self, paths: &[PathBuf], force: bool) -> SqlResult<()> { + for path in paths { + self.scan_directory(path, force)?; + } + Ok(()) + } + + fn scan_directory(&self, dir: &Path, force: bool) -> SqlResult<()> { + if !dir.exists() { + return Ok(()); + } + + let now = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs() as i64; + + self.scan_recursive(dir, now, force)?; + self.cleanup_old_tracks(now)?; + Ok(()) + } + + fn scan_recursive(&self, dir: &Path, scan_time: i64, force: bool) -> SqlResult<()> { + let entries = fs::read_dir(dir).ok(); + if let Some(entries) = entries { + for entry in entries.flatten() { + let path = entry.path(); + if path.is_dir() { + self.scan_recursive(&path, scan_time, force)?; + } else if is_audio_file(&path) { + self.process_audio_file(&path, scan_time, force)?; + } + } + } + Ok(()) + } + + fn process_audio_file(&self, path: &Path, scan_time: i64, force: bool) -> SqlResult<()> { + let path_str = path.to_string_lossy().to_string(); + + if !force { + let count: i64 = self + .conn + .query_row( + "SELECT COUNT(*) FROM tracks WHERE path = ? AND last_scanned = ?", + rusqlite::params![path_str, scan_time], + |row| row.get(0), + ) + .unwrap_or(0); + if count > 0 { + return Ok(()); + } + } + + let metadata = extract_metadata(path); + let (artist_name, album_title, track_title, track_number, duration) = metadata; + let duration_i64 = duration.map(|d| d as i64); + + let artist_id = self.get_or_create_artist(&artist_name)?; + let album_id = self.get_or_create_album(artist_id, &album_title)?; + + self.conn.execute( + "INSERT OR REPLACE INTO tracks (album_id, title, path, duration, track_number, last_scanned) + VALUES (?, ?, ?, ?, ?, ?)", + rusqlite::params![album_id, track_title, path_str, duration_i64, track_number, scan_time], + )?; + + Ok(()) + } + + fn get_or_create_artist(&self, name: &str) -> SqlResult { + self.conn + .execute("INSERT OR IGNORE INTO artists (name) VALUES (?)", [name])?; + self.conn + .query_row("SELECT id FROM artists WHERE name = ?", [name], |row| { + row.get(0) + }) + } + + fn get_or_create_album(&self, artist_id: i64, title: &str) -> SqlResult { + self.conn.execute( + "INSERT OR IGNORE INTO albums (artist_id, title) VALUES (?, ?)", + rusqlite::params![artist_id, title], + )?; + self.conn.query_row( + "SELECT id FROM albums WHERE artist_id = ? AND title = ?", + rusqlite::params![artist_id, title], + |row| row.get(0), + ) + } + + fn cleanup_old_tracks(&self, scan_time: i64) -> SqlResult<()> { + self.conn + .execute("DELETE FROM tracks WHERE last_scanned < ?", [scan_time])?; + Ok(()) + } + + pub fn search_tracks(&self, query: &str) -> SqlResult> { + let mut stmt = self.conn.prepare( + "SELECT t.id, t.album_id, t.title, t.path, t.duration, t.track_number, ar.name, a.title + FROM tracks t + JOIN albums a ON t.album_id = a.id + JOIN artists ar ON a.artist_id = ar.id + WHERE t.title LIKE ? OR a.title LIKE ? OR ar.name LIKE ? + ORDER BY ar.name, a.title, t.track_number", + )?; + + let search = format!("%{}%", query); + let rows = stmt.query_map([&search, &search, &search], |row| { + Ok(Track { + id: row.get(0)?, + album_id: row.get(1)?, + title: row.get(2)?, + path: PathBuf::from(row.get::<_, String>(3)?), + duration: row.get(4)?, + track_number: row.get(5)?, + artist_name: Some(row.get(6)?), + album_title: Some(row.get(7)?), + }) + })?; + + rows.collect() + } +} + +fn is_audio_file(path: &Path) -> bool { + path.extension() + .and_then(|ext| ext.to_str()) + .map(|ext| { + matches!( + ext.to_lowercase().as_str(), + "mp3" | "flac" | "ogg" | "m4a" | "wav" | "opus" + ) + }) + .unwrap_or(false) +} + +fn extract_metadata(path: &Path) -> (String, String, String, Option, Option) { + let file_stem = path + .file_stem() + .and_then(|s| s.to_str()) + .unwrap_or("Unknown"); + let parent = path + .parent() + .and_then(|p| p.file_name()) + .and_then(|s| s.to_str()) + .unwrap_or("Unknown"); + let grandparent = path + .parent() + .and_then(|p| p.parent()) + .and_then(|p| p.file_name()) + .and_then(|s| s.to_str()) + .unwrap_or("Unknown"); + + ( + grandparent.to_string(), + parent.to_string(), + file_stem.to_string(), + None, + None, + ) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..2b88c44 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,18 @@ +mod audio; +mod cli; +mod config; +mod daemon; +mod database; +mod playback; +mod scrobbler; + +use clap::Parser; +use cli::Cli; + +fn main() { + let cli = Cli::parse(); + if let Err(e) = cli.run() { + eprintln!("Error: {}", e); + std::process::exit(1); + } +} diff --git a/src/playback.rs b/src/playback.rs new file mode 100644 index 0000000..76c0f44 --- /dev/null +++ b/src/playback.rs @@ -0,0 +1,131 @@ +use std::path::PathBuf; + +#[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] +pub enum PlaybackState { + Stopped, + Playing, + Paused, +} + +#[derive(Debug, Clone)] +#[allow(dead_code)] +pub struct Track { + pub path: PathBuf, + pub title: String, + pub artist: String, + pub album: String, + pub duration: Option, +} + +#[derive(Debug, Clone)] +#[allow(dead_code)] +pub enum ShuffleMode { + None, + All, + Album, +} + +#[allow(dead_code)] +pub struct Player { + state: PlaybackState, + current_track: Option, + queue: Vec, + volume: u8, + shuffle: ShuffleMode, +} + +#[allow(dead_code)] +impl Player { + pub fn new() -> Self { + Player { + state: PlaybackState::Stopped, + current_track: None, + queue: Vec::new(), + volume: 70, + shuffle: ShuffleMode::None, + } + } + + pub fn state(&self) -> &PlaybackState { + &self.state + } + + pub fn volume(&self) -> u8 { + self.volume + } + + pub fn play(&mut self) { + if self.state == PlaybackState::Paused { + self.resume(); + } else if self.current_track.is_none() && !self.queue.is_empty() { + self.current_track = Some(self.queue.remove(0)); + self.state = PlaybackState::Playing; + } + } + + pub fn play_track(&mut self, track: Track) { + self.current_track = Some(track); + self.state = PlaybackState::Playing; + } + + pub fn pause(&mut self) { + if self.state == PlaybackState::Playing { + self.state = PlaybackState::Paused; + } + } + + pub fn resume(&mut self) { + if self.state == PlaybackState::Paused { + self.state = PlaybackState::Playing; + } + } + + pub fn stop(&mut self) { + self.state = PlaybackState::Stopped; + self.current_track = None; + } + + pub fn next(&mut self) { + if !self.queue.is_empty() { + self.current_track = Some(self.queue.remove(0)); + } else { + self.stop(); + } + } + + pub fn previous(&mut self) { + if (self.state == PlaybackState::Playing || self.state == PlaybackState::Paused) + && self.current_track.is_some() + { + self.state = PlaybackState::Playing; + } + } + + pub fn set_volume(&mut self, level: u8) { + self.volume = level.min(100); + } + + pub fn set_shuffle(&mut self, mode: ShuffleMode) { + self.shuffle = mode; + } + + pub fn queue_track(&mut self, track: Track, position: &str) { + match position { + "now" => self.queue.insert(0, track), + "next" => { + let idx = 1.min(self.queue.len()); + self.queue.insert(idx, track); + } + _ => self.queue.push(track), + } + } + + pub fn dequeue_next(&mut self) -> Option { + if !self.queue.is_empty() { + Some(self.queue.remove(0)) + } else { + None + } + } +} diff --git a/src/scrobbler.rs b/src/scrobbler.rs new file mode 100644 index 0000000..09a7f55 --- /dev/null +++ b/src/scrobbler.rs @@ -0,0 +1,75 @@ +use reqwest::Client; + +#[allow(dead_code)] +pub struct Scrobbler { + lastfm_api_key: Option, + lastfm_api_secret: Option, + lastfm_session_key: Option, + listenbrainz_token: Option, + client: Client, +} + +#[allow(dead_code)] +impl Scrobbler { + pub fn new( + lastfm_api_key: Option, + lastfm_api_secret: Option, + lastfm_session_key: Option, + listenbrainz_token: Option, + ) -> Self { + Scrobbler { + lastfm_api_key, + lastfm_api_secret, + lastfm_session_key, + listenbrainz_token, + client: Client::new(), + } + } + + pub fn now_playing(&self, artist: &str, track: &str, album: Option<&str>) { + if let Some(api_key) = &self.lastfm_api_key { + let _ = self.send_lastfm_now_playing(api_key, artist, track, album); + } + } + + pub fn scrobble(&self, artist: &str, track: &str, album: Option<&str>, timestamp: u64) { + if let Some(api_key) = &self.lastfm_api_key { + let _ = self.send_lastfm_scrobble(api_key, artist, track, album, timestamp); + } + if let Some(token) = &self.listenbrainz_token { + let _ = self.send_listenbrainz_scrobble(token, artist, track, album, timestamp); + } + } + + fn send_lastfm_now_playing( + &self, + _api_key: &str, + _artist: &str, + _track: &str, + _album: Option<&str>, + ) -> Result<(), Box> { + Ok(()) + } + + fn send_lastfm_scrobble( + &self, + _api_key: &str, + _artist: &str, + _track: &str, + _album: Option<&str>, + _timestamp: u64, + ) -> Result<(), Box> { + Ok(()) + } + + fn send_listenbrainz_scrobble( + &self, + _token: &str, + _artist: &str, + _track: &str, + _album: Option<&str>, + _timestamp: u64, + ) -> Result<(), Box> { + Ok(()) + } +} -- cgit v1.2.3