diff --git a/musicdb-client/Cargo.toml b/musicdb-client/Cargo.toml index e7aaf3d..cedcd23 100644 --- a/musicdb-client/Cargo.toml +++ b/musicdb-client/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" [dependencies] musicdb-lib = { path = "../musicdb-lib", default-features = false } -clap = { version = "4.4.6", features = ["derive"] } -directories = "5.0.1" -regex = "1.9.3" -speedy2d = { version = "1.12.0", optional = true } -toml = "0.7.6" +clap = { version = "4.5.45", features = ["derive"] } +directories = "6.0.0" +regex = "1.11.1" +speedy2d = { version = "2.1.0", optional = true } +toml = "0.9.5" # musicdb-mers = { version = "0.1.0", path = "../musicdb-mers", optional = true } uianimator = "0.1.1" @@ -27,7 +27,9 @@ default = ["gui", "default-playback"] # enables syncplayer modes, where the client mirrors the server's playback gui = ["speedy2d"] # merscfg = ["mers", "gui"] +merscfg = [] # mers = ["musicdb-mers"] +mers = [] playback = [] default-playback = ["playback", "musicdb-lib/default-playback"] playback-via-playback-rs = ["playback", "musicdb-lib/playback-via-playback-rs"] diff --git a/musicdb-client/src/gui_text.rs b/musicdb-client/src/gui_text.rs index 1b2a5b0..0a293e5 100755 --- a/musicdb-client/src/gui_text.rs +++ b/musicdb-client/src/gui_text.rs @@ -1,4 +1,4 @@ -use std::{fmt::Display, rc::Rc, sync::Arc}; +use std::{fmt::Display, sync::Arc}; use musicdb_lib::data::CoverId; use speedy2d::{ @@ -30,7 +30,7 @@ pub struct Content { text: String, color: Color, background: Option, - formatted: Option>, + formatted: Option, } #[allow(unused)] diff --git a/musicdb-client/src/main.rs b/musicdb-client/src/main.rs index ef8610e..129e729 100755 --- a/musicdb-client/src/main.rs +++ b/musicdb-client/src/main.rs @@ -1,4 +1,5 @@ -// #![allow(unused)] +#![allow(dead_code)] +#![allow(unused_variables)] use std::{ io::{BufReader, Write}, @@ -146,7 +147,6 @@ fn main() { | Mode::GuiSyncplayerNetwork ); #[cfg(feature = "playback")] - #[allow(unused)] let mut cache_manager = None; #[cfg(feature = "playback")] let mut player = if is_syncplayer { @@ -160,6 +160,12 @@ fn main() { } else { None }; + // prevent unused assignment warning, we might + // need cache manager at some point -_- + #[cfg(feature = "playback")] + if false { + drop(cache_manager); + } #[allow(unused_labels)] 'ifstatementworkaround: { // use if+break instead of if-else because we can't #[cfg(feature)] the if statement, diff --git a/musicdb-filldb/Cargo.toml b/musicdb-filldb/Cargo.toml index 9a9da6d..0d982ca 100755 --- a/musicdb-filldb/Cargo.toml +++ b/musicdb-filldb/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -id3 = "1.16.0" +id3 = "1.16.3" mp3-duration = "0.1.10" musicdb-lib = { version = "0.1.0", path = "../musicdb-lib" } diff --git a/musicdb-lib/Cargo.toml b/musicdb-lib/Cargo.toml index 9684195..ee58f3d 100644 --- a/musicdb-lib/Cargo.toml +++ b/musicdb-lib/Cargo.toml @@ -7,10 +7,10 @@ edition = "2021" base64 = "0.22.1" colorize = "0.1.0" playback-rs = { version = "0.4.4", optional = true } -rand = "0.8.5" +rand = "0.9.2" rc-u8-reader = "2.0.16" -rodio = { version = "0.20.1", optional = true } -sysinfo = "0.30.12" +rodio = { version = "0.21.1", optional = true } +sysinfo = "0.37.0" [features] default = [] diff --git a/musicdb-lib/src/data/cache_manager.rs b/musicdb-lib/src/data/cache_manager.rs index 8c11199..802382a 100644 --- a/musicdb-lib/src/data/cache_manager.rs +++ b/musicdb-lib/src/data/cache_manager.rs @@ -39,8 +39,8 @@ impl CacheManager { let sleep_dur_long = Duration::from_secs(20); let sleep_dur_short = Duration::from_secs(1); let mut si = sysinfo::System::new_with_specifics( - sysinfo::RefreshKind::new() - .with_memory(sysinfo::MemoryRefreshKind::new().with_ram()), + sysinfo::RefreshKind::nothing() + .with_memory(sysinfo::MemoryRefreshKind::nothing().with_ram()), ); eprintln!("[{}] Starting CacheManager", "INFO".cyan()); let mut sleep_short = true; @@ -54,7 +54,7 @@ impl CacheManager { }); sleep_short = false; // memory stuff - si.refresh_memory_specifics(sysinfo::MemoryRefreshKind::new().with_ram()); + si.refresh_memory_specifics(sysinfo::MemoryRefreshKind::nothing().with_ram()); let available_memory = si.available_memory(); let min_avail_mem = min_avail_mem.load(std::sync::atomic::Ordering::Relaxed); let low_memory = available_memory < min_avail_mem; diff --git a/musicdb-lib/src/data/database.rs b/musicdb-lib/src/data/database.rs index e3fb51f..7bc0bc9 100755 --- a/musicdb-lib/src/data/database.rs +++ b/musicdb-lib/src/data/database.rs @@ -9,7 +9,7 @@ use std::{ }; use colorize::AnsiColor; -use rand::thread_rng; +use rand::rng; use crate::{ load::ToFromBytes, @@ -690,7 +690,7 @@ impl Database { }) = elem.content_mut() { let mut ord: Vec = (0..content.len()).collect(); - ord.shuffle(&mut thread_rng()); + ord.shuffle(&mut rng()); self.apply_action_unchecked_seq( Action::QueueSetShuffle(path, ord, set_index), client, diff --git a/musicdb-lib/src/data/queue.rs b/musicdb-lib/src/data/queue.rs index 71b1b19..1c6968c 100755 --- a/musicdb-lib/src/data/queue.rs +++ b/musicdb-lib/src/data/queue.rs @@ -418,7 +418,7 @@ impl Queue { } impl QueueFolder { - pub fn iter(&self) -> QueueFolderIter { + pub fn iter(&self) -> QueueFolderIter<'_> { QueueFolderIter { folder: self, index: 0, diff --git a/musicdb-lib/src/player/rodio.rs b/musicdb-lib/src/player/rodio.rs index b06bce2..867b328 100644 --- a/musicdb-lib/src/player/rodio.rs +++ b/musicdb-lib/src/player/rodio.rs @@ -1,7 +1,7 @@ use std::{ffi::OsStr, sync::Arc}; use rc_u8_reader::ArcU8Reader; -use rodio::{decoder::DecoderError, Decoder, OutputStream, OutputStreamHandle, Sink, Source}; +use rodio::{decoder::DecoderError, Decoder, OutputStream, Sink, Source}; use crate::{ data::{song::Song, SongId}, @@ -13,8 +13,6 @@ use super::PlayerBackend; pub struct PlayerBackendRodio { #[allow(unused)] output_stream: OutputStream, - #[allow(unused)] - output_stream_handle: OutputStreamHandle, sink: Sink, stopped: bool, current: Option<(SongId, Arc>, Option, T)>, @@ -34,11 +32,11 @@ impl PlayerBackendRodio { pub fn new_with_optional_command_sending( command_sender: Option)>>, ) -> Result> { - let (output_stream, output_stream_handle) = rodio::OutputStream::try_default()?; - let sink = Sink::try_new(&output_stream_handle)?; + let output_stream = + rodio::OutputStreamBuilder::from_default_device()?.open_stream_or_fallback()?; + let sink = Sink::connect_new(&output_stream.mixer()); Ok(Self { output_stream, - output_stream_handle, sink, stopped: true, current: None, diff --git a/musicdb-lib/src/server/mod.rs b/musicdb-lib/src/server/mod.rs index a8cfcd0..f018595 100755 --- a/musicdb-lib/src/server/mod.rs +++ b/musicdb-lib/src/server/mod.rs @@ -437,7 +437,7 @@ pub fn run_server_caching_thread_opt( pub fn handle_one_connection_as_main( db: Arc>, connection: &mut impl Read, - mut send_to: (impl Write + Sync + Send + 'static), + mut send_to: impl Write + Sync + Send + 'static, command_sender: &mpsc::Sender<(Command, Option)>, ) -> Result<(), std::io::Error> { // sync database diff --git a/musicdb-server/Cargo.toml b/musicdb-server/Cargo.toml index 3f197dc..f94e099 100644 --- a/musicdb-server/Cargo.toml +++ b/musicdb-server/Cargo.toml @@ -7,12 +7,12 @@ edition = "2021" [dependencies] musicdb-lib = { path = "../musicdb-lib" } -clap = { version = "4.4.6", features = ["derive"] } -headers = "0.3.8" +clap = { version = "4.5.45", features = ["derive"] } +headers = "0.4.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -tokio = { version = "1.37.0", optional = true, features = ["rt"] } -rocket = { version = "0.5.0", optional = true } +tokio = { version = "1.47.1", optional = true, features = ["rt"] } +rocket = { version = "0.5.1", optional = true } html-escape = { version = "0.2.13", optional = true } rocket_ws = "0.1.1" rocket_seek_stream = "0.2.6" diff --git a/musicdb-server/src/web.rs b/musicdb-server/src/web.rs index 4197114..248a803 100755 --- a/musicdb-server/src/web.rs +++ b/musicdb-server/src/web.rs @@ -302,14 +302,14 @@ fn now_playing_ids(data: &State) -> String { } #[get("/song/")] -fn song1(data: &State, id: SongId) -> Option { +fn song1(data: &State, id: SongId) -> Option> { song(data, id) } #[get("/song//<_>")] -fn song2(data: &State, id: SongId) -> Option { +fn song2(data: &State, id: SongId) -> Option> { song(data, id) } -fn song(data: &State, id: SongId) -> Option { +fn song(data: &State, id: SongId) -> Option> { let db = data.db.lock().unwrap(); if let Some(song) = db.get_song(&id) { song.cached_data().cache_data_start_thread(&*db, song);