@@ -37,6 +37,7 @@ use futures_util::StreamExt;
3737use protobuf:: MessageField ;
3838use std:: {
3939 future:: Future ,
40+ ops:: Deref ,
4041 sync:: atomic:: { AtomicUsize , Ordering } ,
4142 sync:: Arc ,
4243 time:: { Duration , SystemTime , UNIX_EPOCH } ,
@@ -934,6 +935,7 @@ impl SpircTask {
934935 shuffle,
935936 repeat,
936937 repeat_track,
938+ autoplay : false ,
937939 } ,
938940 Some ( play. context ) ,
939941 )
@@ -1127,7 +1129,6 @@ impl SpircTask {
11271129 self . handle_activate ( ) ;
11281130 }
11291131
1130- let current_context_uri = self . connect_state . context_uri ( ) ;
11311132 let fallback = if let Some ( ref ctx) = context {
11321133 match ConnectState :: get_context_uri_from_context ( ctx) {
11331134 Some ( ctx_uri) => ctx_uri,
@@ -1137,6 +1138,16 @@ impl SpircTask {
11371138 & cmd. context_uri
11381139 } ;
11391140
1141+ let update_context = if cmd. autoplay {
1142+ UpdateContext :: Autoplay
1143+ } else {
1144+ UpdateContext :: Default
1145+ } ;
1146+
1147+ self . connect_state
1148+ . set_active_context ( * update_context. deref ( ) ) ;
1149+
1150+ let current_context_uri = self . connect_state . context_uri ( ) ;
11401151 if current_context_uri == & cmd. context_uri && fallback == cmd. context_uri {
11411152 debug ! ( "context <{current_context_uri}> didn't change, no resolving required" )
11421153 } else {
@@ -1145,7 +1156,7 @@ impl SpircTask {
11451156 self . context_resolver . add ( ResolveContext :: from_uri (
11461157 & cmd. context_uri ,
11471158 fallback,
1148- UpdateContext :: Default ,
1159+ update_context ,
11491160 ContextAction :: Replace ,
11501161 ) ) ;
11511162 let context = self . context_resolver . get_next_context ( Vec :: new) . await ;
@@ -1182,9 +1193,11 @@ impl SpircTask {
11821193 cmd. shuffle, cmd. repeat, cmd. repeat_track
11831194 ) ;
11841195
1185- self . connect_state . set_shuffle ( cmd. shuffle ) ;
1186- self . connect_state . set_repeat_context ( cmd. repeat ) ;
1187- self . connect_state . set_repeat_track ( cmd. repeat_track ) ;
1196+ self . connect_state . set_shuffle ( !cmd. autoplay && cmd. shuffle ) ;
1197+ self . connect_state
1198+ . set_repeat_context ( !cmd. autoplay && cmd. repeat ) ;
1199+ self . connect_state
1200+ . set_repeat_track ( !cmd. autoplay && cmd. repeat_track ) ;
11881201
11891202 if cmd. shuffle {
11901203 if let Some ( index) = index {
0 commit comments