From e6fe2ac00eb0913117e775ab6800ab9e32e7ec9e Mon Sep 17 00:00:00 2001 From: Felix Prillwitz Date: Mon, 16 Dec 2024 23:24:53 +0100 Subject: [PATCH] revert removal of state setup --- connect/src/context_resolver.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/connect/src/context_resolver.rs b/connect/src/context_resolver.rs index eb7ff355..bc55907b 100644 --- a/connect/src/context_resolver.rs +++ b/connect/src/context_resolver.rs @@ -341,6 +341,25 @@ impl ContextResolver { if let Err(why) = state.finish_transfer(transfer_state) { error!("finishing setup of transfer failed: {why}") } + } else { + let res = if state.shuffling_context() { + state.shuffle() + } else if let Ok(ctx) = state.get_context(state.active_context) { + let idx = ConnectState::find_index_in_context(ctx, |t| { + state.current_track(|c| t.uri == c.uri) + }) + .ok(); + + state + .reset_playback_to_position(idx) + .and_then(|_| state.fill_up_next_tracks()) + } else { + state.fill_up_next_tracks() + }; + + if let Err(why) = res { + error!("setting up state failed after updating contexts: {why}") + } } state.update_restrictions();