diff --git a/Cargo.lock b/Cargo.lock index 011ed7a3..db6793d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,6 +150,32 @@ dependencies = [ "tokio", ] +[[package]] +name = "async-executor" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc5ea910c42e5ab19012bab31f53cb4d63d54c3a27730f9a833a88efcf4bb52d" +dependencies = [ + "async-lock 3.1.1", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite 2.0.1", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "blocking", + "futures-lite 1.13.0", +] + [[package]] name = "async-io" version = "1.13.0" @@ -176,14 +202,14 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" dependencies = [ - "async-lock 3.1.0", + "async-lock 3.1.1", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.0.1", "parking", "polling 3.3.0", - "rustix 0.38.21", + "rustix 0.38.25", "slab", "tracing", "waker-fn", @@ -201,9 +227,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +checksum = "655b9c7fe787d3b25cc0f804a1a8401790f0c5bc395beb5a64dc77d8de079105" dependencies = [ "event-listener 3.1.0", "event-listener-strategy", @@ -223,7 +249,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.21", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -250,7 +276,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.21", + "rustix 0.38.25", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -343,7 +369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel", - "async-lock 3.1.0", + "async-lock 3.1.1", "async-task", "fastrand 2.0.1", "futures-io", @@ -399,9 +425,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.84" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -589,9 +615,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2268a214a6f118fce1838edba3d1561cf0e78d8de785475957a580a7f8c69d33" +checksum = "62c6fcf842f17f8c78ecf7c81d75c5ce84436b41ee07e03f490fbb5f5a8731d8" dependencies = [ "diesel_derives", "libsqlite3-sys", @@ -731,9 +757,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys 0.48.0", @@ -881,7 +907,11 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" dependencies = [ + "fastrand 2.0.1", "futures-core", + "futures-io", + "memchr", + "parking", "pin-project-lite", ] @@ -1432,9 +1462,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", @@ -1442,19 +1472,13 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "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 = "hashbrown" version = "0.14.2" @@ -1505,9 +1529,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "http" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f95b9abcae896730d42b78e09c155ed4ddf82c07b4de772c64aee5b2d8b7c150" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -1579,12 +1603,12 @@ dependencies = [ [[package]] name = "implicit-clone" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c5448a864f9abf124ef8bf2a3cc37eb9fd99fe2e804a8b3235d7357bca2c25" +checksum = "fc06a255cbf402a52ae399c05a518c68c569c916ea11423620111df576b9b9bb" dependencies = [ "implicit-clone-derive", - "indexmap 2.1.0", + "indexmap", ] [[package]] @@ -1597,16 +1621,6 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.1.0" @@ -1614,7 +1628,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown", ] [[package]] @@ -1673,7 +1687,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.21", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -1742,9 +1756,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ "pkg-config", "vcpkg", @@ -2069,7 +2083,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap", ] [[package]] @@ -2157,7 +2171,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.21", + "rustix 0.38.25", "tracing", "windows-sys 0.48.0", ] @@ -2426,9 +2440,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -2743,15 +2757,15 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", - "rustix 0.38.21", + "rustix 0.38.25", "windows-sys 0.48.0", ] [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -2846,7 +2860,6 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.5", "tokio-macros", - "tracing", "windows-sys 0.48.0", ] @@ -2937,7 +2950,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap", "serde 1.0.192", "serde_spanned", "toml_datetime", @@ -2950,7 +2963,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.1.0", + "indexmap", "toml_datetime", "winnow", ] @@ -2961,7 +2974,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.1.0", + "indexmap", "serde 1.0.192", "serde_spanned", "toml_datetime", @@ -3548,7 +3561,7 @@ dependencies = [ "futures", "gloo 0.10.0", "implicit-clone", - "indexmap 2.1.0", + "indexmap", "js-sys", "prokio", "rustversion", @@ -3585,9 +3598,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" dependencies = [ "async-broadcast", + "async-executor", + "async-fs", + "async-io 1.13.0", + "async-lock 2.8.0", "async-process", "async-recursion", + "async-task", "async-trait", + "blocking", "byteorder", "derivative", "enumflags2", @@ -3604,7 +3623,6 @@ dependencies = [ "serde_repr", "sha1", "static_assertions", - "tokio", "tracing", "uds_windows", "winapi 0.3.9", diff --git a/Cargo.toml b/Cargo.toml index 46b6c827..d7bbe020 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ tokio = { version = "1.33.0", features = ["full"] } viola_common = {path ="viola_common", features =["backend"]} walkdir = "2.4.0" warp = { version = "0.3.6", features = ["compression"] } -zbus = { version = "3.14.1", default-features = false, features = ["tokio"]} +zbus = { version = "3.14.1"} [workspace] members = ["web_gui_yew", "viola_common"] diff --git a/src/dbus_interface.rs b/src/dbus_interface.rs index fea91970..21427132 100644 --- a/src/dbus_interface.rs +++ b/src/dbus_interface.rs @@ -1,6 +1,5 @@ use log::info; use parking_lot::RwLock; -use std::future::pending; use std::{collections::HashMap, sync::Arc}; use crate::{gstreamer_wrapper::GStreamer, loaded_playlist::LoadedPlaylistExt, types::*}; @@ -12,51 +11,51 @@ struct BaseInterface {} #[dbus_interface(name = "org.mpris.MediaPlayer2")] impl BaseInterface { #[dbus_interface(property)] - fn can_quit(&self) -> bool { + async fn can_quit(&self) -> bool { false } #[dbus_interface(property)] - fn fullscreen(&self) -> bool { + async fn fullscreen(&self) -> bool { false } #[dbus_interface(property)] - fn can_set_fullscreen(&self) -> bool { + async fn can_set_fullscreen(&self) -> bool { false } #[dbus_interface(property)] - fn can_raise(&self) -> bool { + async fn can_raise(&self) -> bool { false } #[dbus_interface(property)] - fn has_track_list(&self) -> bool { + async fn has_track_list(&self) -> bool { false } #[dbus_interface(property)] - fn identity(&self) -> String { + async fn identity(&self) -> String { String::from("Viola") } #[dbus_interface(property)] - fn supported_uri_schemes(&self) -> Vec { + async fn supported_uri_schemes(&self) -> Vec { vec![] } #[dbus_interface(property)] - fn supported_mime_types(&self) -> Vec { + async fn supported_mime_types(&self) -> Vec { vec![] } //methods - fn raise(&self) -> zbus::fdo::Result<()> { + async fn raise(&self) -> zbus::fdo::Result<()> { Ok(()) } - fn quit(&self) -> zbus::fdo::Result<()> { + async fn quit(&self) -> zbus::fdo::Result<()> { Ok(()) } } @@ -69,23 +68,23 @@ struct PlayerInterface { #[dbus_interface(name = "org.mpris.MediaPlayer2.Player")] impl PlayerInterface { #[dbus_interface(property)] - fn playback_status(&self) -> String { + async fn playback_status(&self) -> String { info!("dbus playback status"); self.gstreamer.read().get_state().to_string() } #[dbus_interface(property)] - fn loop_status(&self) -> String { + async fn loop_status(&self) -> String { "None".to_string() } #[dbus_interface(property)] - fn rate(&self) -> f64 { + async fn rate(&self) -> f64 { 1.0 } #[dbus_interface(property)] - fn metadata(&self) -> HashMap<&str, zbus::zvariant::Value> { + async fn metadata(&self) -> HashMap<&str, zbus::zvariant::Value> { info!("dbus metadata"); let mut map = HashMap::new(); let track = self.playlisttabs.get_current_track(); @@ -98,71 +97,71 @@ impl PlayerInterface { } #[dbus_interface(property)] - fn volume(&self) -> f64 { + async fn volume(&self) -> f64 { 1.0 } #[dbus_interface(property)] - fn position(&self) -> i64 { + async fn position(&self) -> i64 { 1_000_000 * self.gstreamer.read().get_elapsed().unwrap_or(0) as i64 } #[dbus_interface(property)] - fn minimum_rate(&self) -> f64 { + async fn minimum_rate(&self) -> f64 { 1.0 } #[dbus_interface(property)] - fn maximum_rate(&self) -> f64 { + async fn maximum_rate(&self) -> f64 { 1.0 } #[dbus_interface(property)] - fn can_go_next(&self) -> bool { + async fn can_go_next(&self) -> bool { true } #[dbus_interface(property)] - fn can_go_previous(&self) -> bool { + async fn can_go_previous(&self) -> bool { true } #[dbus_interface(property)] - fn can_play(&self) -> bool { + async fn can_play(&self) -> bool { true } #[dbus_interface(property)] - fn can_pause(&self) -> bool { + async fn can_pause(&self) -> bool { true } #[dbus_interface(property)] - fn can_seek(&self) -> bool { + async fn can_seek(&self) -> bool { false } #[dbus_interface(property)] - fn can_control(&self) -> bool { + async fn can_control(&self) -> bool { true } //methods - fn next(&self) -> zbus::fdo::Result<()> { + async fn next(&self) -> zbus::fdo::Result<()> { self.gstreamer .write() .do_gstreamer_action(GStreamerAction::Next); Ok(()) } - fn previous(&self) -> zbus::fdo::Result<()> { + async fn previous(&self) -> zbus::fdo::Result<()> { self.gstreamer .write() .do_gstreamer_action(GStreamerAction::Previous); Ok(()) } - fn pause(&self) -> zbus::fdo::Result<()> { + async fn pause(&self) -> zbus::fdo::Result<()> { info!("dbus send pause"); self.gstreamer .write() @@ -175,7 +174,7 @@ impl PlayerInterface { Ok(()) } - fn play(&self) -> zbus::fdo::Result<()> { + async fn play(&self) -> zbus::fdo::Result<()> { info!("dbus send play"); self.gstreamer .write() @@ -188,7 +187,7 @@ impl PlayerInterface { Ok(()) } - fn play_pause(&self) -> zbus::fdo::Result<()> { + async fn play_pause(&self) -> zbus::fdo::Result<()> { info!("dbus send playpause"); if self.gstreamer.read().get_state() == GStreamerMessage::Pausing { self.gstreamer @@ -212,7 +211,7 @@ impl PlayerInterface { Ok(()) } - fn stop(&self) -> zbus::fdo::Result<()> { + async fn stop(&self) -> zbus::fdo::Result<()> { println!("dbus send pause"); self.gstreamer .write() @@ -225,19 +224,19 @@ impl PlayerInterface { Ok(()) } - fn seek(&self, _position: i32) -> zbus::fdo::Result<()> { + async fn seek(&self, _position: i32) -> zbus::fdo::Result<()> { todo!("NYI"); //Not Implemented Ok(()) } - fn set_position(&self, _track_id: String, _position: i32) -> zbus::fdo::Result<()> { + async fn set_position(&self, _track_id: String, _position: i32) -> zbus::fdo::Result<()> { //Not Implemented todo!("NYI"); Ok(()) } - fn open_uri(&self, _s: String) -> zbus::fdo::Result<()> { + async fn open_uri(&self, _s: String) -> zbus::fdo::Result<()> { todo!("NYI"); Ok(()) } @@ -262,13 +261,15 @@ pub(crate) async fn main( .expect("Could not serve dbus") .serve_at("/org/mpris/MediaPlayer2", player_interface) .expect("Could not serve player dbus") - .internal_executor(true) + //.internal_executor(true) .build() .await .expect("Error in creating connection"); //{ //tokio::task::spawn(async move { + std::future::pending::<()>().await; + /* info!("doing signal"); let iface_ref = conn .object_server() @@ -309,5 +310,6 @@ pub(crate) async fn main( }, }; } + */ Ok(()) } diff --git a/src/main.rs b/src/main.rs index b21d1af2..e666da4b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,8 +90,6 @@ fn main() -> Result<()> { //env::set_var("RUST_LOG", "actix_web=debug,actix_server=info"); env_logger::init(); - let (shutdown_send, mut shutdown_recv) = tokio::sync::mpsc::unbounded_channel::<()>(); - let tmp_pool = db::setup_db_connection(); if tmp_pool.is_err() { println!("Something is wrong with db, creating it.");