From ae22d2191c1b9dd8b3a4fa3dc66ecc0a4caa31a4 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Thu, 2 Feb 2023 21:43:50 -0500 Subject: [PATCH] Add a license, build a tester for the media player --- errors/Cargo.lock | 7 + errors/Cargo.toml | 8 + errors/src/lib.rs | 18 + flake.lock | 14 +- flake.nix | 1 + music-player/server/Cargo.lock | 1255 ++++++++++++++++----- music-player/server/Cargo.toml | 10 +- music-player/server/src/audio.rs | 232 ++++ music-player/server/src/bin/playertest.rs | 52 + music-player/server/src/core.rs | 47 + music-player/server/src/lib.rs | 1 + music-player/server/src/main.rs | 128 ++- 12 files changed, 1454 insertions(+), 319 deletions(-) create mode 100644 errors/Cargo.lock create mode 100644 errors/Cargo.toml create mode 100644 errors/src/lib.rs create mode 100644 music-player/server/src/audio.rs create mode 100644 music-player/server/src/bin/playertest.rs create mode 100644 music-player/server/src/core.rs create mode 100644 music-player/server/src/lib.rs diff --git a/errors/Cargo.lock b/errors/Cargo.lock new file mode 100644 index 0000000..c9f36ca --- /dev/null +++ b/errors/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "errors" +version = "0.1.0" diff --git a/errors/Cargo.toml b/errors/Cargo.toml new file mode 100644 index 0000000..926ecdd --- /dev/null +++ b/errors/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "errors" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/errors/src/lib.rs b/errors/src/lib.rs new file mode 100644 index 0000000..755788d --- /dev/null +++ b/errors/src/lib.rs @@ -0,0 +1,18 @@ +use std::error::Error; +use std::result; + +pub trait FatalError {} + +pub type Result = result::Result, FE>; + +pub fn ok(val: A) -> Result { + Ok(Ok(val)) +} + +pub fn error(err: E) -> Result { + Ok(Err(err)) +} + +pub fn fatal(err: FE) -> Result { + Err(err) +} diff --git a/flake.lock b/flake.lock index 48d910a..660a40f 100644 --- a/flake.lock +++ b/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1674242456, - "narHash": "sha256-yBy7rCH7EiBe9+CHZm9YB5ii5GRa+MOxeW0oDEBO8SE=", + "lastModified": 1675918889, + "narHash": "sha256-hy7re4F9AEQqwZxubct7jBRos6md26bmxnCjxf5utJA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cdead16a444a3e5de7bc9b0af8e198b11bb01804", + "rev": "49efda9011e8cdcd6c1aad30384cb1dc230c82fe", "type": "github" }, "original": { @@ -52,7 +52,7 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "narHash": "sha256-GWnDfrKbQPb+skMMesm1WVu7a3y3GTDpYpfOv3yF4gc=", + "narHash": "sha256-0eO3S+2gLODqDoloufeC99PfQ5mthuN9JADzqFXid1Y=", "type": "tarball", "url": "https://github.com/oxalica/rust-overlay/archive/master.tar.gz" }, @@ -70,11 +70,11 @@ }, "unstable": { "locked": { - "lastModified": 1674211260, - "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "lastModified": 1675942811, + "narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "rev": "724bfc0892363087709bd3a5a1666296759154b1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8d5fb12..6cfd0b1 100644 --- a/flake.nix +++ b/flake.nix @@ -26,6 +26,7 @@ name = "ld-tools-devshell"; buildInputs = [ pkgs.clang + pkgs.dbus pkgs.entr pkgs.glade pkgs.gtk4 diff --git a/music-player/server/Cargo.lock b/music-player/server/Cargo.lock index eee1cd8..402af25 100644 --- a/music-player/server/Cargo.lock +++ b/music-player/server/Cargo.lock @@ -3,62 +3,16 @@ version = 3 [[package]] -name = "aho-corasick" -version = "0.7.20" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "ansi_term" -version = "0.12.1" +name = "base64" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "bindgen" -version = "0.59.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "clap", - "env_logger", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "which", -] +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bitflags" @@ -67,34 +21,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "cc" -version = "1.0.78" +name = "block-buffer" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ - "nom", + "generic-array", ] [[package]] -name = "cfg-expr" -version = "0.11.0" +name = "buf_redux" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0357a6402b295ca3a86bc148e84df46c02e41f41fef186bda662557ef6328aa" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" dependencies = [ - "smallvec", + "memchr", + "safemem", ] [[package]] -name = "cfg-if" -version = "0.1.10" +name = "byteorder" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "cfg-if" @@ -103,115 +58,380 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "clang-sys" -version = "1.4.0" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "glob", "libc", - "libloading", ] [[package]] -name = "clap" -version = "2.34.0" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "ansi_term", - "atty", - "bitflags", + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote 1.0.23", "strsim", - "textwrap", - "unicode-width", - "vec_map", + "syn 1.0.107", ] [[package]] -name = "cookie-factory" -version = "0.3.2" +name = "darling_macro" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" - -[[package]] -name = "either" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" - -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "darling_core", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] -name = "errno" -version = "0.2.8" +name = "dbus" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" dependencies = [ - "errno-dragonfly", "libc", + "libdbus-sys", "winapi", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "derive_is_enum_variant" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "d0ac8859845146979953797f03cc5b282fb4396891807cdb3d04929a88418197" dependencies = [ - "cc", - "libc", + "heck", + "quote 0.3.15", + "syn 0.11.11", ] [[package]] -name = "glob" -version = "0.3.1" +name = "digest" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "enum-kinds" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e40a16955681d469ab3da85aaa6b42ff656b3c67b52e1d8d3dd36afe97fd462" +dependencies = [ + "proc-macro2", + "quote 1.0.23", + "syn 1.0.107", +] + +[[package]] +name = "errors" +version = "0.1.0" + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "from_variants" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6e0c314d32a210f213d2de7fc205a415498c32477022bffdb8927a95f44493" +dependencies = [ + "from_variants_impl", +] + +[[package]] +name = "from_variants_impl" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243da8644e4e4ac28a22f7f30187f9d3f17eafbc219884ff8935edb5ebfe621c" +dependencies = [ + "darling", + "proc-macro2", + "quote 1.0.23", + "syn 1.0.107", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-core", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "headers" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" +dependencies = [ + "base64", + "bitflags", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] [[package]] name = "heck" -version = "0.4.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] [[package]] -name = "humantime" -version = "2.1.0" +name = "http" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "http-body" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] [[package]] -name = "lazycell" -version = "1.3.0" +name = "httparse" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "libc" @@ -220,39 +440,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] -name = "libloading" -version = "0.7.4" +name = "libdbus-sys" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "2264f9d90a9b4e60a2dc722ad899ea0374f03c2e96e755fe22a8f551d4d5fb3c" dependencies = [ - "cfg-if 1.0.0", - "winapi", + "pkg-config", ] [[package]] -name = "libspa" -version = "0.5.0" +name = "lock_api" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8bb02bbc8d550e2f0a31989c61e1ac3c883bab2edee49ffcb5d5ca18266786d" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ - "bitflags", - "cc", - "cookie-factory", - "errno", - "libc", - "libspa-sys", - "nom", - "system-deps", -] - -[[package]] -name = "libspa-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8d2e38d6cdd10d7d78eb0cb409c127cf16da2c296d9623375551e309616d4d" -dependencies = [ - "bindgen", - "system-deps", + "autocfg", + "scopeguard", ] [[package]] @@ -261,7 +464,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -271,39 +474,85 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "mime" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "mio" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + +[[package]] +name = "mpris" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3d377fd27d9d5c7145341cd3affcb83839c24c73e7460488b3ae0a3f9c5166" +dependencies = [ + "dbus", + "derive_is_enum_variant", + "enum-kinds", + "from_variants", + "thiserror", +] + +[[package]] +name = "multipart" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" +dependencies = [ + "buf_redux", + "httparse", + "log", + "mime", + "mime_guess", + "quick-error", + "rand", + "safemem", + "tempfile", + "twoway", +] [[package]] name = "music-player" version = "0.1.0" dependencies = [ - "pipewire", + "dbus", + "errors", + "mpris", + "serde", + "thiserror", + "tokio", + "warp", ] [[package]] -name = "nix" -version = "0.14.1" +name = "num_cpus" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", + "hermit-abi", "libc", - "void", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", ] [[package]] @@ -313,46 +562,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] -name = "peeking_take_while" -version = "0.1.2" +name = "parking_lot" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] [[package]] -name = "pipewire" -version = "0.5.0" +name = "parking_lot_core" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d80fef8219c37f479f3d62d70167f3daaa90b71a083f7fd88d69e49f05f0ecdc" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ - "anyhow", - "bitflags", - "errno", + "cfg-if", "libc", - "libspa", - "libspa-sys", - "once_cell", - "pipewire-sys", - "signal", - "thiserror", + "redox_syscall", + "smallvec", + "windows-sys", ] [[package]] -name = "pipewire-sys" -version = "0.5.0" +name = "percent-encoding" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6d4262ea1fd3b01786046d1892cc49e9578d872faf8723d95dc7affc810ee4" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ - "bindgen", - "libspa-sys", - "system-deps", + "pin-project-internal", ] +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote 1.0.23", + "syn 1.0.107", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro2" version = "1.0.50" @@ -362,6 +643,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" + [[package]] name = "quote" version = "1.0.23" @@ -372,48 +665,167 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.7.1" +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", + "libc", + "rand_chacha", + "rand_core", ] [[package]] -name = "regex-syntax" -version = "0.6.28" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] [[package]] -name = "rustc-hash" +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "rustls-pemfile" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +dependencies = [ + "base64", +] + +[[package]] +name = "ryu" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] [[package]] -name = "shlex" -version = "1.1.0" +name = "serde_derive" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote 1.0.23", + "syn 1.0.107", +] [[package]] -name = "signal" -version = "0.7.0" +name = "serde_json" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f6ce83b159ab6984d2419f495134972b48754d13ff2e3f8c998339942b56ed9" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", - "nix", +] + +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", ] [[package]] @@ -423,10 +835,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] -name = "strsim" -version = "0.8.0" +name = "socket2" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +dependencies = [ + "quote 0.3.15", + "synom", + "unicode-xid", +] [[package]] name = "syn" @@ -435,39 +868,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", - "quote", + "quote 1.0.23", "unicode-ident", ] [[package]] -name = "system-deps" -version = "6.0.3" +name = "synom" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2955b1fe31e1fa2fbd1976b71cc69a606d7d4da16f6de3333d0c92d51419aeff" +checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" dependencies = [ - "cfg-expr", - "heck", - "pkg-config", - "toml", - "version-compare", + "unicode-xid", ] [[package]] -name = "termcolor" -version = "1.2.0" +name = "tempfile" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", ] [[package]] @@ -486,19 +911,175 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] -name = "toml" -version = "0.5.11" +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ - "serde", + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote 1.0.23", + "syn 1.0.107", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +dependencies = [ + "base64", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand", + "sha-1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "twoway" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" +dependencies = [ + "memchr", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" + [[package]] name = "unicode-ident" version = "1.0.6" @@ -506,40 +1087,96 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] -name = "unicode-width" -version = "0.1.10" +name = "unicode-normalization" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version-compare" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "which" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ - "either", - "libc", - "once_cell", + "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" + +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "warp" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7b8be92646fc3d18b06147664ebc5f48d222686cb11a8755e561a735aacc6d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "headers", + "http", + "hyper", + "log", + "mime", + "mime_guess", + "multipart", + "percent-encoding", + "pin-project", + "rustls-pemfile", + "scoped-tls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-stream", + "tokio-tungstenite", + "tokio-util", + "tower-service", + "tracing", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "winapi" version = "0.3.9" @@ -556,17 +1193,65 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" diff --git a/music-player/server/Cargo.toml b/music-player/server/Cargo.toml index f1b12b9..8e3b176 100644 --- a/music-player/server/Cargo.toml +++ b/music-player/server/Cargo.toml @@ -6,4 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pipewire = { version = "0.5" } +dbus = { version = "0.9.7" } +errors = { path = "../../errors" } +mpris = { version = "2.0" } +serde = { version = "1.0", features = ["derive"] } +thiserror = { version = "1.0" } +tokio = { version = "1.24", features = ["full"] } +warp = { version = "0.3" } + +[lib] diff --git a/music-player/server/src/audio.rs b/music-player/server/src/audio.rs new file mode 100644 index 0000000..e68e7cb --- /dev/null +++ b/music-player/server/src/audio.rs @@ -0,0 +1,232 @@ +/* +Copyright 2023, Savanni D'Gerinel + +This file is part of the Luminescent Dreams Tools. + +Luminescent Dreams Tools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +Luminescent Dreams Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with Lumeto. If not, see . +*/ + +use dbus::ffidisp::Connection; +use mpris::{FindingError, PlaybackStatus, Player, PlayerFinder, ProgressTick}; +use serde::Serialize; +use std::{ + path::PathBuf, + sync::mpsc::{channel, Receiver, Sender, TryRecvError}, + thread, + time::Duration, +}; +use thiserror::Error; + +pub enum Message { + Quit, +} + +#[derive(Clone, Debug)] +pub enum Event { + Paused(Track, Duration), + Playing(Track, Duration), + Stopped, + Position(Track, Duration), +} + +#[derive(Debug)] +pub struct DeviceInformation { + pub address: String, + pub name: String, +} + +pub fn list_devices(conn: Connection) -> Result, FindingError> { + Ok(PlayerFinder::for_connection(conn) + .find_all()? + .into_iter() + .map(|player| DeviceInformation { + address: player.unique_name().to_owned(), + name: player.identity().to_owned(), + }) + .collect()) +} + +#[derive(Debug, Error)] +pub enum AudioError { + #[error("DBus device was not found")] + DeviceNotFound, + + #[error("DBus connection lost or otherwise failed")] + ConnectionLost, + + #[error("Specified media cannot be found")] + MediaNotFound, + + #[error("Play was ordered, but nothing is in the queue")] + NothingInQueue, + + #[error("Unknown dbus error")] + DbusError(dbus::Error), + + #[error("Unknown problem with mpris")] + MprisError(mpris::DBusError), +} + +impl From for AudioError { + fn from(err: dbus::Error) -> Self { + Self::DbusError(err) + } +} + +impl From for AudioError { + fn from(err: mpris::DBusError) -> Self { + Self::MprisError(err) + } +} + +#[derive(Clone, Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Track { + pub track_number: Option, + pub name: Option, + pub album: Option, + pub artist: Option, +} + +impl From<&mpris::Metadata> for Track { + fn from(data: &mpris::Metadata) -> Self { + Self { + track_number: data.track_number(), + name: data.title().map(|s| s.to_owned()), + album: data.album_name().map(|s| s.to_owned()), + artist: None, + } + } +} + +impl From for Track { + fn from(data: mpris::Metadata) -> Self { + Self::from(&data) + } +} + +#[derive(Clone, Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub enum State { + Playing(Track), + Paused(Track), + Stopped, +} + +pub struct CurrentlyPlaying { + track: Track, + position: Duration, +} + +#[derive(Clone, Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Capabilities { + pub can_control: bool, + pub can_pause: bool, + pub can_play: bool, + pub supports_track_lists: bool, +} + +pub trait AudioPlayer { + fn capabilities(&self) -> Result; + fn state(&self) -> Result; + fn play_pause(&self) -> Result; +} + +pub struct MprisDevice { + device_id: String, + player: Player, + state: State, +} + +impl MprisDevice { + pub fn new(device_id: String) -> Result { + let connection = Connection::new_session()?; + Ok(MprisDevice { + device_id: device_id.clone(), + player: mpris::Player::new(connection, device_id, 1000)?, + state: State::Stopped, + }) + } + + pub fn run(&mut self, control_channel: Receiver) { + let (tx, rx) = channel(); + { + let device_id = self.device_id.clone(); + let tx = tx.clone(); + thread::spawn(move || { + MprisDevice::new(device_id) + .expect("connect to bus") + .monitor_progress(tx); + }); + }; + + loop { + match control_channel.try_recv() { + Ok(Message::Quit) => return, + Err(TryRecvError::Empty) => {} + Err(TryRecvError::Disconnected) => return, + } + let event = rx.recv().expect("receive should never fail"); + println!("event received: {:?}", event); + } + } + + pub fn monitor_progress(&self, tx: Sender) { + let mut tracker = self + .player + .track_progress(1000) + .expect("can get an event stream"); + loop { + let ProgressTick { progress, .. } = tracker.tick(); + match progress.playback_status() { + PlaybackStatus::Playing => { + tx.send(Event::Playing( + Track::from(progress.metadata()), + progress.position(), + )) + .expect("send to succeed"); + } + PlaybackStatus::Paused => { + tx.send(Event::Paused( + Track::from(progress.metadata()), + progress.position(), + )) + .expect("send to succeed"); + } + PlaybackStatus::Stopped => { + tx.send(Event::Stopped).expect("send to succeed"); + } + } + } + } +} + +impl AudioPlayer for MprisDevice { + fn capabilities(&self) -> Result { + Ok(Capabilities { + can_control: self.player.can_control()?, + can_pause: self.player.can_pause()?, + can_play: self.player.can_play()?, + supports_track_lists: self.player.supports_track_lists(), + }) + } + + fn state(&self) -> Result { + println!( + "supports track lists: {:?}", + self.player.supports_track_lists() + ); + let metadata = self.player.get_metadata()?; + println!("{:?}", metadata); + unimplemented!("AudioPlayer state") + } + + fn play_pause(&self) -> Result { + unimplemented!("Audioplayer play/pause command") + } +} diff --git a/music-player/server/src/bin/playertest.rs b/music-player/server/src/bin/playertest.rs new file mode 100644 index 0000000..dece14d --- /dev/null +++ b/music-player/server/src/bin/playertest.rs @@ -0,0 +1,52 @@ +/* +Copyright 2023, Savanni D'Gerinel + +This file is part of the Luminescent Dreams Tools. + +Luminescent Dreams Tools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +Luminescent Dreams Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with Lumeto. If not, see . +*/ + +use dbus::ffidisp::Connection; +use music_player::audio::{list_devices, Message, MprisDevice}; +use std::{io, thread}; + +fn main() { + for device in list_devices(Connection::new_session().expect("connection to dbus session")) + .expect("to list devices") + { + println!("Device: [{}] {}", device.address, device.name); + } + + /* + let progress_thread = thread::spawn(|| MprisDevice::monitor_progress(":1.1611".to_owned())); + let event_thread = thread::spawn(|| MprisDevice::scan_event_stream(":1.1611".to_owned())); + */ + + let (tx, rx) = std::sync::mpsc::channel(); + let app_thread = thread::spawn(move || { + let mut device = MprisDevice::new(":1.1611".to_owned()).expect("to get a device"); + device.run(rx); + }); + + let stdin = io::stdin(); + let mut input = String::new(); + let _ = stdin.read_line(&mut input); + let _ = tx.send(Message::Quit); + + let _ = app_thread.join(); + + /* + println!( + "{:?}", + device.capabilities().expect("can retrieve capabilities") + ); + // println!("{:?}", device.state().expect("play-pause to succeed")); + + let _ = progress_thread.join(); + let _ = event_thread.join(); + */ +} diff --git a/music-player/server/src/core.rs b/music-player/server/src/core.rs new file mode 100644 index 0000000..571d84d --- /dev/null +++ b/music-player/server/src/core.rs @@ -0,0 +1,47 @@ +use dbus::ffidisp::Connection; +use mpris::{Player, PlayerFinder}; + +#[derive(Clone, Debug, Serialize)] +#[serde(rename_all = "camelCase")] +struct Device { + dbus_name: String, + name: String, +} + +pub struct Core { + conn: Connection, + player: Player, +} + +impl Core { + fn new(&self) -> Result { + let conn = Connection::new_session()?; + Ok(Core { + conn, + player: mpris::Player::new(conn, ":1.6".to_owned(), 1000)?, + }) + } + + fn list_devices(&self) -> Result, Error> { + mpris::PlayerFinder::for_connection(conn) + .find_all()? + .into_iter() + .map(|player| Device { + dbus_name: player.unique_name().to_owned(), + name: player.identity().to_owned(), + }) + .collect() + } + + fn list_tracks(&self) -> Result, Error> { + self.player + .get_track_list()? + .ids() + .into_iter() + .map(|id| id.as_str().to_owned()) + .collect() + } +} + +#[cfg(test)] +mod test {} diff --git a/music-player/server/src/lib.rs b/music-player/server/src/lib.rs new file mode 100644 index 0000000..fa3e4e4 --- /dev/null +++ b/music-player/server/src/lib.rs @@ -0,0 +1 @@ +pub mod audio; diff --git a/music-player/server/src/main.rs b/music-player/server/src/main.rs index a7f975f..7560eaf 100644 --- a/music-player/server/src/main.rs +++ b/music-player/server/src/main.rs @@ -1,30 +1,106 @@ -use pipewire::{ - channel, - keys::{MEDIA_CATEGORY, MEDIA_ROLE, MEDIA_TYPE}, - properties, - stream::Stream, - Context, Loop, MainLoop, -}; -use std::time::Duration; +use dbus::ffidisp::Connection; +use serde::Serialize; +use std::net::{IpAddr, Ipv4Addr, SocketAddr}; +use std::path::PathBuf; +use warp::Filter; -fn main() -> Result<(), Box> { - let mainloop = MainLoop::new()?; - let context = Context::new(&mainloop)?; - let core = context.connect(None)?; - let registry = core.get_registry()?; +pub mod audio; - let stream = Stream::new( - &core, - "audio-src", - properties! { - MEDIA_TYPE => "Audio", - MEDIA_CATEGORY => "Playback", - MEDIA_ROLE => "Music", +/* +fn tracks() -> Vec { + vec![ + Track { + track_number: Some(1), + name: Some("Underground".to_owned()), + album: Some("Artemis".to_owned()), + artist: Some("Lindsey Stirling".to_owned()), + path: PathBuf::from("/mnt/music/Lindsey Stirling/Artemis/01 - Underground.ogg"), }, - ) - .expect("to get a stream"); - - mainloop.run(); - - Ok(()) + Track { + track_number: Some(2), + name: Some("Artemis".to_owned()), + album: Some("Artemis".to_owned()), + artist: Some("Lindsey Stirling".to_owned()), + path: PathBuf::from("/mnt/music/Lindsey Stirling/Artemis/02 - Artemis.ogg"), + }, + Track { + track_number: Some(3), + name: Some("Til the Light Goes Out".to_owned()), + album: Some("Artemis".to_owned()), + artist: Some("Lindsey Stirling".to_owned()), + path: PathBuf::from( + "/mnt/music/Lindsey Stirling/Artemis/03 - Til the Light Goes Out.ogg", + ), + }, + Track { + track_number: Some(4), + name: Some("Between Twilight".to_owned()), + album: Some("Artemis".to_owned()), + artist: Some("Lindsey Stirling".to_owned()), + path: PathBuf::from("/mnt/music/Lindsey Stirling/Artemis/04 - Between Twilight.ogg"), + }, + Track { + track_number: Some(5), + name: Some("Foreverglow".to_owned()), + album: Some("Artemis".to_owned()), + artist: Some("Lindsey Stirling".to_owned()), + path: PathBuf::from("/mnt/music/Lindsey Stirling/Artemis/05 - Foreverglow.ogg"), + }, + ] +} +*/ + +#[tokio::main] +pub async fn main() { + /* + let connection = Connection::new_session().expect("to connect to dbus"); + + for player in list_players(connection) { + println!("player found: {}", player.identity()); + } + */ + + /* + let devices = warp::path!("api" / "v1" / "devices") + .and(warp::get()) + .map(|| { + let conn = Connection::new_session().expect("to connect to dbus"); + warp::reply::json(&list_devices(conn)) + }); + + let track_list = warp::path!("api" / "v1" / "tracks") + .and(warp::get()) + .map(|| warp::reply::json(&tracks())); + let tracks_for_artist = warp::path!("api" / "v1" / "artist" / String) + .and(warp::get()) + .map(|_artist: String| warp::reply::json(&tracks())); + let tracks_for_album = warp::path!("api" / "v1" / "album" / String) + .and(warp::get()) + .map(|_album: String| warp::reply::json(&tracks())); + + let queue = warp::path!("api" / "v1" / "queue") + .and(warp::get()) + .map(|| { + let conn = Connection::new_session().expect("to connect to dbus"); + warp::reply::json(&list_tracks(conn)) + }); + + let playing_status = warp::path!("api" / "v1" / "play-pause") + .and(warp::get()) + .map(|| warp::reply::json(&PlayPause::Paused)); + + let routes = devices + .or(track_list) + .or(tracks_for_album) + .or(tracks_for_artist) + .or(queue) + .or(playing_status); + let server = warp::serve(routes); + server + .run(SocketAddr::new( + IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), + 8002, + )) + .await; + */ }