From 547e7ac5218327216704e1fb72004a3de6992940 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 6 Jul 2026 15:49:27 +0200 Subject: add MPRIS support and non-blocking notifs --- Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Cargo.lock') diff --git a/Cargo.lock b/Cargo.lock index 43b17e7..0c3c6af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "RSPlayer" -version = "0.8.6" +version = "0.9.0" dependencies = [ "clap", "clap_complete", @@ -23,6 +23,7 @@ dependencies = [ "serde_json", "symphonia", "toml", + "zbus", ] [[package]] -- cgit v1.2.3 From fdfe24213d70b5548fb09051a0e32b7224210231 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 6 Jul 2026 15:58:01 +0200 Subject: add track index to MPRIS --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/mpris.rs | 5 ++++- src/queue.rs | 3 +++ tests/daemon.rs | 1 + tests/queue.rs | 2 ++ 6 files changed, 12 insertions(+), 3 deletions(-) (limited to 'Cargo.lock') diff --git a/Cargo.lock b/Cargo.lock index 0c3c6af..acf5ce5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "RSPlayer" -version = "0.9.0" +version = "0.9.1" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index e795707..ce8ca48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "RSPlayer" -version = "0.9.0" +version = "0.9.1" edition = "2024" description = "Rust music player daemon with Unix socket IPC" license = "GPL-3.0 or later" diff --git a/src/mpris.rs b/src/mpris.rs index 0c637c0..a7ac360 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -128,7 +128,10 @@ fn build_metadata(track: &Track) -> HashMap> { Value::new(track.album.clone().unwrap_or_default()), ); - map.insert("xesam:trackNumber".into(), Value::new(0i32)); + map.insert( + "xesam:trackNumber".into(), + Value::new(track.track_number.unwrap_or(0)), + ); map } diff --git a/src/queue.rs b/src/queue.rs index 7675ddd..1f2f0fc 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -98,6 +98,7 @@ pub struct Track { pub title: Option, pub artist: Option, pub album: Option, + pub track_number: Option, pub duration_secs: Option, pub is_stream: bool, } @@ -115,6 +116,7 @@ impl Track { title: metadata.and_then(|m| m.title.clone()), artist: metadata.and_then(|m| m.artist.clone()), album: metadata.and_then(|m| m.album.clone()), + track_number: metadata.and_then(|m| m.track_number), duration_secs: metadata.and_then(|m| m.duration_secs), is_stream: false, } @@ -139,6 +141,7 @@ impl Track { title: Some(title), artist: None, album: None, + track_number: None, duration_secs: None, is_stream: true, } diff --git a/tests/daemon.rs b/tests/daemon.rs index e5cb270..01241fd 100644 --- a/tests/daemon.rs +++ b/tests/daemon.rs @@ -26,6 +26,7 @@ fn test_scrobble_state_clear() { title: Some("Test".into()), artist: Some("Artist".into()), album: None, + track_number: None, duration_secs: Some(200.0), is_stream: false, }; diff --git a/tests/queue.rs b/tests/queue.rs index 59311d2..2eaa6f3 100644 --- a/tests/queue.rs +++ b/tests/queue.rs @@ -14,6 +14,7 @@ fn track(path: &str, title: Option<&str>, artist: Option<&str>, album: Option<&s title: title.map(|s| s.to_string()), artist: artist.map(|s| s.to_string()), album: album.map(|s| s.to_string()), + track_number: None, duration_secs: None, is_stream: false, } @@ -25,6 +26,7 @@ fn track_no_meta(path: &str) -> Track { title: None, artist: None, album: None, + track_number: None, duration_secs: None, is_stream: false, } -- cgit v1.2.3