Skip to content

Commit

Permalink
connect: adjust fields for PlayCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
photovoltex committed Nov 24, 2024
1 parent 232fb60 commit dab0948
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions connect/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion connect/src/spirc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion core/src/dealer/protocol/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ pub struct PlayOptions {
pub skip_to: SkipTo,
#[serde(default, deserialize_with = "option_json_proto")]
pub player_options_override: Option<ContextPlayerOptionOverrides>,
pub license: String,
pub license: Option<String>,
// possible to send wie web-api
pub seek_to: Option<u32>,
// mobile
pub always_play_something: Option<bool>,
pub audio_stream: Option<String>,
Expand Down
1 change: 1 addition & 0 deletions examples/play_connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ async fn main() {
.load(SpircLoadCommand {
context_uri,
start_playing: true,
seek_to: 0,
shuffle: false,
repeat: false,
repeat_track: false,
Expand Down

0 comments on commit dab0948

Please sign in to comment.