diff --git a/src/rust/amadeus-next/amalib/src/query.rs b/src/rust/amadeus-next/amalib/src/query.rs index dba0e41b2df6063facb17d009e2ef7c398969b94..5bccb15f064fe6b221fce8ebb1f09c8a7ecffe71 100644 --- a/src/rust/amadeus-next/amalib/src/query.rs +++ b/src/rust/amadeus-next/amalib/src/query.rs @@ -35,7 +35,7 @@ pub enum LektorQuery { PlayNext, PlayPrevious, CropQueue, - ShuffleQueue(LektorPriorityLevel), + ShuffleQueue, ClearQueue(LektorPriorityLevel), SwapInQueue(usize, usize), SeekIdInQueue(usize), @@ -124,7 +124,7 @@ impl LektorQuery { | RestartServer | PlayNext | PlayPrevious - | ShuffleQueue(_) + | ShuffleQueue | SwapInQueue(_, _) | SeekIdInQueue(_) | ClearQueue(_) @@ -181,7 +181,7 @@ impl LektorQuery { | PlaybackStatus | PlayNext | PlayPrevious - | ShuffleQueue(_) + | ShuffleQueue | ListAllPlaylists | ListPlaylist(_) | SwapInQueue(_, _) @@ -262,7 +262,7 @@ impl LektorQuery { UnPause => lkt_str!("pause 0"), PlayNext => lkt_str!("next"), PlayPrevious => lkt_str!("previous"), - ShuffleQueue(lvl) => lkt_str!("shuffle {lvl}"), + ShuffleQueue => lkt_str!("shuffle"), SwapInQueue(p1, p2) => lkt_str!("swap {p1} {p2}"), SeekIdInQueue(id) => lkt_str!("seek {id}"), diff --git a/src/rust/amadeus-next/lkt-rs/src/args.rs b/src/rust/amadeus-next/lkt-rs/src/args.rs index 485fe2a3613483713830637a8768f14bbff94a5b..512abd963d09d5255eb216c3281e35b278d12e8f 100644 --- a/src/rust/amadeus-next/lkt-rs/src/args.rs +++ b/src/rust/amadeus-next/lkt-rs/src/args.rs @@ -152,17 +152,15 @@ enum SubCommand { )] seek: Option<usize>, - #[arg( action = clap::ArgAction::Set + #[arg( action = clap::ArgAction::SetTrue , exclusive = true , short = 'z' , long = "shuffle" - , id = "SHUFFLE_LVL" , help = concat!( "Shuffle the queue. If lektord was paused it will unpause but if it was stopped it won't start. " , "If it exists, the current kara will be placed in the first place in the queue. " - , "You can also pass a level to shuffle up to. The level can be passed as a numeric or as its string representation. " - , "[default value: 5, possible values: 1..5]" + , "Priorities will be kept, the shuffle occures inside a priority level." ))] - shuffle: Option<Option<LektorPriorityLevel>>, + shuffle: bool, }, // Search commands @@ -375,9 +373,7 @@ pub(crate) enum LktQueueCommand { id: usize, }, - Shuffle { - up_to_lvl: LektorPriorityLevel, - }, + Shuffle, } #[derive(Debug, Clone, PartialEq, Eq)] @@ -438,12 +434,12 @@ impl LktCommand { SubCommand::Queue { next: true, .. } => Queue(LktQueueCommand::Next), SubCommand::Queue { prev: true, .. } => Queue(LktQueueCommand::Previous), SubCommand::Queue { stop: true, .. } => Queue(LktQueueCommand::Stop), - SubCommand::Queue { current: true, .. } => { Queue(LktQueueCommand::ShowCurrent) } - SubCommand::Queue { status: true, .. } => { Queue(LktQueueCommand::ShowStatus) } + SubCommand::Queue { current: true, .. } => Queue(LktQueueCommand::ShowCurrent), + SubCommand::Queue { status: true, .. } => Queue(LktQueueCommand::ShowStatus), + SubCommand::Queue { shuffle: true, .. } => Queue(LktQueueCommand::Shuffle), SubCommand::Queue { pause: Some(None), .. } => Queue(LktQueueCommand::TogglePause), SubCommand::Queue { pause: Some(Some(true)), .. } => Queue(LktQueueCommand::Pause), SubCommand::Queue { pause: Some(Some(false)), .. } => Queue(LktQueueCommand::UnPause), - SubCommand::Queue { shuffle: Some(lvl), .. } => Queue(LktQueueCommand::Shuffle { up_to_lvl: lvl.unwrap_or(LektorPriorityLevel::Enforce) }), SubCommand::Queue { clear: Some(lvl), .. } => Queue(LktQueueCommand::Clear { up_to_lvl: lvl.unwrap_or(LektorPriorityLevel::Enforce) }), SubCommand::Queue { seek: Some(id), .. } => { Queue(LktQueueCommand::SeekIdInQueue { id }) } SubCommand::Queue { play: Some(index), .. } => Queue(LktQueueCommand::Play { index }), diff --git a/src/rust/amadeus-next/lkt-rs/src/main.rs b/src/rust/amadeus-next/lkt-rs/src/main.rs index 5173c7986da39c02d929ce12bb312eb285e20c8c..84b26d7c3a07c6493635c44f66e2df54ce3a406f 100644 --- a/src/rust/amadeus-next/lkt-rs/src/main.rs +++ b/src/rust/amadeus-next/lkt-rs/src/main.rs @@ -139,8 +139,8 @@ async fn handle_cmd_queue(config: LktConfig, mut conn: LektorConnexion, cmd: Lkt LktQueueCommand::Clear { up_to_lvl } => { send!(conn => LektorQuery::ClearQueue(up_to_lvl); ok) } - LktQueueCommand::Shuffle { up_to_lvl } => { - send!(conn => LektorQuery::ShuffleQueue(up_to_lvl); ok) + LktQueueCommand::Shuffle => { + send!(conn => LektorQuery::ShuffleQueue; ok) } LktQueueCommand::SwapPositions { p1, p2 } => { send!(conn => LektorQuery::SwapInQueue(p1, p2); ok)