diff --git a/CHANGELOG.md b/CHANGELOG.md index ff851de..84544c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to cloofy. The format follows [Keep a Changelog](https://kee ## [Unreleased] +## [0.5.1] - 2026-11-05 + +cloofy takes on your terminal's colors or your own, and song notifications reach every terminal on Linux. + ### Added - **Your terminal's colors.** Settings has Colors now. **Terminal** takes your terminal's background and text, with the shades in between mixed from them, so cloofy looks at home in a purple Ptyxis on Ubuntu or any other theme. **Auto** stays as before: Omarchy's theme there, cloofy's own dark colors elsewhere, which **cloofy** keeps everywhere. @@ -22,6 +26,7 @@ All notable changes to cloofy. The format follows [Keep a Changelog](https://kee - **Spotify's mixes in your library.** The playlists Spotify makes for you, like Club Mix, Hip Hop Mix, the Daily Mixes and Discover Weekly, show up in your library once you've saved them in Spotify, in the order you picked there. So do the other Spotify playlists you follow. Spotify's Web API leaves them out, so cloofy now lists your library the way Spotify's own apps do. - **Spotify's mixes in search.** Searching for "synthwave" or "club mix" finds your Synthwave Mix or Club Mix first, as in Spotify, and shows the song count wherever Spotify gives it. - **`cloofy doctor`** checks both. +- **`CLOOFY_LOG` with a trailing comma,** as in `info,`, logs at that level instead of errors only. ### Security @@ -141,7 +146,8 @@ The first release. - **Session restore.** The page, the selection and the last track come back after a restart. - **Installer.** It sets everything up step by step. -[Unreleased]: https://github.com/parda21/cloofy/compare/v0.5.0...HEAD +[Unreleased]: https://github.com/parda21/cloofy/compare/v0.5.1...HEAD +[0.5.1]: https://github.com/parda21/cloofy/compare/v0.5.0...v0.5.1 [0.5.0]: https://github.com/parda21/cloofy/compare/v0.4.0...v0.5.0 [0.4.0]: https://github.com/parda21/cloofy/compare/v0.3.0...v0.4.0 [0.3.0]: https://github.com/parda21/cloofy/compare/v0.2.0...v0.3.0 diff --git a/Cargo.lock b/Cargo.lock index be264aa..8faa208 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -436,7 +436,7 @@ checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" [[package]] name = "cloofy" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "clap", @@ -461,7 +461,7 @@ dependencies = [ [[package]] name = "cloofy-core" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "cloofy-os", @@ -480,7 +480,7 @@ dependencies = [ [[package]] name = "cloofy-os" -version = "0.5.0" +version = "0.5.1" dependencies = [ "block2", "dispatch2", @@ -501,7 +501,7 @@ dependencies = [ [[package]] name = "cloofy-player" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "cloofy-core", @@ -515,7 +515,7 @@ dependencies = [ [[package]] name = "cloofy-spotify" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "base64 0.23.1", @@ -538,7 +538,7 @@ dependencies = [ [[package]] name = "cloofy-tui" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "base64 0.23.1", @@ -571,7 +571,7 @@ dependencies = [ [[package]] name = "cloofy-ytmusic" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "cloofy-core", diff --git a/Cargo.toml b/Cargo.toml index 3271d30..d10d4d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["crates/*"] exclude = ["vendor"] [workspace.package] -version = "0.5.0" +version = "0.5.1" edition = "2024" rust-version = "1.90" license = "MIT" diff --git a/crates/cloofy/src/main.rs b/crates/cloofy/src/main.rs index f25325d..ab66f91 100644 --- a/crates/cloofy/src/main.rs +++ b/crates/cloofy/src/main.rs @@ -206,12 +206,7 @@ fn services(paths: &Paths, named: Option<&str>) -> Result> { /// Logs go to stderr for CLI commands; the TUI owns the screen, so it logs to a file. fn init_logging(paths: &Paths, tui: bool) -> Result<()> { - // Same syntax as before, such as `info,librespot=debug`, without EnvFilter's regexes. - let filter = std::env::var("CLOOFY_LOG") - .ok() - .and_then(|filter| filter.parse::().ok()) - .unwrap_or_else(|| Targets::new().with_default(tracing::Level::ERROR)); - let logs = tracing_subscriber::registry().with(filter); + let logs = tracing_subscriber::registry().with(log_filter(std::env::var("CLOOFY_LOG").ok().as_deref())); if tui { std::fs::create_dir_all(&paths.cache)?; std::fs::File::create(paths.log_file())?; @@ -300,12 +295,34 @@ fn link_service(input: &str) -> Option { } } +/// What `CLOOFY_LOG` asks for, with the same syntax as before, such as `info,librespot=debug`, +/// without EnvFilter's regexes; errors only when it's unset or unreadable. Empty directives, as in +/// a trailing comma, are left out: `Targets` reads one as errors only for everything, so +/// `info,` logged errors only. +fn log_filter(spec: Option<&str>) -> Targets { + let errors = || Targets::new().with_default(tracing::Level::ERROR); + let directives: Vec<&str> = spec.unwrap_or_default().split(',').map(str::trim).filter(|d| !d.is_empty()).collect(); + if directives.is_empty() { errors() } else { directives.join(",").parse().unwrap_or_else(|_| errors()) } +} + #[cfg(test)] mod tests { use clap::CommandFactory; use super::*; + #[test] + fn log_filters_leave_out_empty_directives() { + use tracing::Level; + let on = |spec, target, level| log_filter(spec).would_enable(target, &level); + assert!(on(None, "cloofy", Level::ERROR) && !on(None, "cloofy", Level::WARN)); + assert!(on(Some(""), "cloofy", Level::ERROR), "empty is unset"); + assert!(on(Some("info,"), "cloofy", Level::INFO), "a trailing comma keeps info"); + assert!(on(Some(" info , librespot=debug"), "librespot", Level::DEBUG)); + assert!(!on(Some("info,librespot=debug"), "cloofy", Level::DEBUG)); + assert!(on(Some("=not a level"), "cloofy", Level::ERROR), "unreadable is unset"); + } + #[test] fn links_go_to_their_service() { assert_eq!(link_service("https://open.spotify.com/album/2noRn2Aes5aoNVsU6iWThc"), Some(Service::Spotify));