From dab0948aaaeeb4fd6efdf500398a102c44cdbf09 Mon Sep 17 00:00:00 2001 From: Felix Prillwitz Date: Sun, 24 Nov 2024 21:27:50 +0100 Subject: [PATCH] connect: adjust fields for PlayCommand --- connect/src/model.rs | 1 + connect/src/spirc.rs | 3 ++- core/src/dealer/protocol/request.rs | 4 +++- examples/play_connect.rs | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/connect/src/model.rs b/connect/src/model.rs index d2e17247d..5872382b4 100644 --- a/connect/src/model.rs +++ b/connect/src/model.rs @@ -105,6 +105,7 @@ pub struct SpircLoadCommand { pub context_uri: String, /// Whether the given tracks should immediately start playing, or just be initially loaded. pub start_playing: bool, + pub seek_to: u32, pub shuffle: bool, pub repeat: bool, pub repeat_track: bool, diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 68cea3584..f0277ea02 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -975,6 +975,7 @@ impl SpircTask { SpircLoadCommand { context_uri: play.context.uri.clone(), start_playing: true, + seek_to: play.options.seek_to.unwrap_or_default(), playing_track: play.options.skip_to.into(), shuffle, repeat, @@ -1235,7 +1236,7 @@ impl SpircTask { self.connect_state.set_repeat_track(cmd.repeat_track); if self.connect_state.current_track(MessageField::is_some) { - self.load_track(cmd.start_playing, 0)?; + self.load_track(cmd.start_playing, cmd.seek_to)?; } else { info!("No active track, stopping"); self.handle_stop(); diff --git a/core/src/dealer/protocol/request.rs b/core/src/dealer/protocol/request.rs index 2248c8f98..85426a305 100644 --- a/core/src/dealer/protocol/request.rs +++ b/core/src/dealer/protocol/request.rs @@ -168,7 +168,9 @@ pub struct PlayOptions { pub skip_to: SkipTo, #[serde(default, deserialize_with = "option_json_proto")] pub player_options_override: Option, - pub license: String, + pub license: Option, + // possible to send wie web-api + pub seek_to: Option, // mobile pub always_play_something: Option, pub audio_stream: Option, diff --git a/examples/play_connect.rs b/examples/play_connect.rs index 9bdcf9a9c..9a033da23 100644 --- a/examples/play_connect.rs +++ b/examples/play_connect.rs @@ -79,6 +79,7 @@ async fn main() { .load(SpircLoadCommand { context_uri, start_playing: true, + seek_to: 0, shuffle: false, repeat: false, repeat_track: false,