diff --git a/Cargo.lock b/Cargo.lock index c930295..0c57370 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -667,7 +667,7 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "soulseek-rs" -version = "0.2.0" +version = "0.2.1" dependencies = [ "clap", "color-eyre", @@ -677,7 +677,7 @@ dependencies = [ [[package]] name = "soulseek-rs-lib" -version = "0.2.0" +version = "0.2.1" [[package]] name = "static_assertions" diff --git a/Cargo.toml b/Cargo.toml index 44fc08b..bb4ddc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["soulseek-rs-lib", "soulseek-rs"] resolver = "2" [workspace.package] -version = "0.2.0" +version = "0.2.1" authors = ["Michel de Graaf"] edition = "2021" license = "MIT" diff --git a/soulseek-rs/Cargo.toml b/soulseek-rs/Cargo.toml index 96b6412..7173fee 100644 --- a/soulseek-rs/Cargo.toml +++ b/soulseek-rs/Cargo.toml @@ -14,7 +14,7 @@ name = "soulseek-rs" path = "src/main.rs" [dependencies] -soulseek-rs-lib = { version = "0.2.0", path = "../soulseek-rs-lib" } +soulseek-rs-lib = { version = "0.2.1", path = "../soulseek-rs-lib" } clap = { version = "4.5.51", features = ["derive", "color", "wrap_help", "env"] } ratatui = "0.29.0" diff --git a/soulseek-rs/src/main.rs b/soulseek-rs/src/main.rs index 2e5a9d6..531a7a0 100644 --- a/soulseek-rs/src/main.rs +++ b/soulseek-rs/src/main.rs @@ -11,10 +11,7 @@ use models::FileDownloadState; use soulseek_rs::{Client, ClientSettings, PeerAddress}; use std::{ env, - sync::{ - atomic::AtomicBool, - Arc, - }, + sync::{atomic::AtomicBool, Arc}, time::Duration, }; use ui::{show_multi_download_progress, FileSelector}; diff --git a/soulseek-rs/src/ui/file_selector.rs b/soulseek-rs/src/ui/file_selector.rs index 3ef8375..1c30c3b 100644 --- a/soulseek-rs/src/ui/file_selector.rs +++ b/soulseek-rs/src/ui/file_selector.rs @@ -5,7 +5,10 @@ use ratatui::{ crossterm::event::{self, poll, Event, KeyCode, KeyEvent, KeyEventKind}, layout::{Alignment, Constraint, Layout}, style::{Color, Style}, - widgets::{Block, Borders, Cell, Paragraph, Row, StatefulWidget, Table, TableState, Wrap}, + widgets::{ + Block, Borders, Cell, Paragraph, Row, StatefulWidget, Table, + TableState, Wrap, + }, DefaultTerminal, Frame, }; use soulseek_rs::Client; @@ -461,11 +464,29 @@ impl FileSelector { if let Some(info_area) = info_area { let (info_text, title, color) = if self.is_searching { - (format!("Search: {}", self.search_query), "Filter", Color::Yellow) + ( + format!("Search: {}", self.search_query), + "Filter", + Color::Yellow, + ) } else if !self.search_query.is_empty() { - (format!("Current filter: {} (press / to modify, c to clear)", self.search_query), "Filter", Color::Cyan) + ( + format!( + "Current filter: {} (press / to modify, c to clear)", + self.search_query + ), + "Filter", + Color::Cyan, + ) } else { - (format!("{} file(s) selected for download", self.selected_indices.len()), "Selection", Color::Green) + ( + format!( + "{} file(s) selected for download", + self.selected_indices.len() + ), + "Selection", + Color::Green, + ) }; let info_widget = Paragraph::new(info_text) diff --git a/soulseek-rs/src/ui/multi_download_progress.rs b/soulseek-rs/src/ui/multi_download_progress.rs index 91431e9..d966b52 100644 --- a/soulseek-rs/src/ui/multi_download_progress.rs +++ b/soulseek-rs/src/ui/multi_download_progress.rs @@ -1,11 +1,15 @@ use crate::models::FileDownloadState; -use crate::ui::{format_bytes_progress, format_speed, header_style, highlight_style}; +use crate::ui::{ + format_bytes_progress, format_speed, header_style, highlight_style, +}; use color_eyre::Result; use ratatui::{ crossterm::event::{self, poll, Event, KeyCode, KeyEvent, KeyEventKind}, layout::{Constraint, Layout}, style::{Color, Style}, - widgets::{Block, Borders, Cell, Paragraph, Row, StatefulWidget, Table, TableState}, + widgets::{ + Block, Borders, Cell, Paragraph, Row, StatefulWidget, Table, TableState, + }, DefaultTerminal, Frame, }; use soulseek_rs::DownloadStatus; diff --git a/soulseek-rs/src/ui/utils.rs b/soulseek-rs/src/ui/utils.rs index cc0f7ea..f56a4e6 100644 --- a/soulseek-rs/src/ui/utils.rs +++ b/soulseek-rs/src/ui/utils.rs @@ -14,6 +14,8 @@ pub fn format_speed(speed_bytes_per_sec: f64) -> String { format!("{:.1} MB/s", mb) } -pub fn get_bitrate(attribs: &std::collections::HashMap) -> Option { +pub fn get_bitrate( + attribs: &std::collections::HashMap, +) -> Option { attribs.get(&0).copied() }