mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-08-27 09:42:51 +00:00
rs-terminal: add subcommand for SetPlaylistItem
This commit is contained in:
parent
5b7a9be80a
commit
6b7931e2b9
2 changed files with 20 additions and 1 deletions
|
@ -179,6 +179,19 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.required(true)
|
||||
.takes_value(true),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("set_playlist_item")
|
||||
.about("")
|
||||
.arg(
|
||||
Arg::with_name("item_index")
|
||||
.short('i')
|
||||
.long("item_index")
|
||||
.value_name("INDEX")
|
||||
.help("Index of the item in the playlist that should be play")
|
||||
.required(true)
|
||||
.takes_value(true),
|
||||
)
|
||||
);
|
||||
|
||||
let matches = app.get_matches();
|
||||
|
@ -375,6 +388,12 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
|||
});
|
||||
println!("Sent setspeed {:?}", setspeed_message);
|
||||
session.send_message(Opcode::SetSpeed, &setspeed_message)?;
|
||||
} else if let Some(set_playlist_item_matches) = matches.subcommand_matches("set_playlist_item") {
|
||||
let message = v3::SetPlaylistItemMessage {
|
||||
item_index: set_playlist_item_matches.value_of("item_index").expect("item_index required").parse::<u64>()?,
|
||||
};
|
||||
session.send_message(Opcode::SetPlaylistItem, &message)?;
|
||||
println!("Sent set_playlist_item {message:?}");
|
||||
} else {
|
||||
println!("Invalid command. Use --help for more information.");
|
||||
std::process::exit(1);
|
||||
|
|
|
@ -227,7 +227,7 @@ pub struct PlayUpdateMessage {
|
|||
#[derive(Serialize, Debug)]
|
||||
pub struct SetPlaylistItemMessage {
|
||||
#[serde(rename = "itemIndex")]
|
||||
pub item_index: Option<u64>,
|
||||
pub item_index: u64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue