fix: No response on play and pause commands
This commit is contained in:
parent
0f4cf287e1
commit
156afe9545
2 changed files with 29 additions and 3 deletions
29
src/main.rs
29
src/main.rs
|
@ -122,8 +122,32 @@ fn main() {
|
|||
println!("There was an error decoding the message: {:?}", error)
|
||||
}
|
||||
Ok(req) => match req {
|
||||
UIRequest::Play => sink.play(),
|
||||
UIRequest::Pause => sink.pause(),
|
||||
UIRequest::Play => {
|
||||
sink.play();
|
||||
sockets[i]
|
||||
.write_message(
|
||||
serde_json::to_string(&ServerResponse {
|
||||
message: "Player Resumed".into(),
|
||||
search_results: vec![],
|
||||
})
|
||||
.unwrap()
|
||||
.into(),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
UIRequest::Pause => {
|
||||
sink.pause();
|
||||
sockets[i]
|
||||
.write_message(
|
||||
serde_json::to_string(&ServerResponse {
|
||||
message: "Player Paused".into(),
|
||||
search_results: vec![],
|
||||
})
|
||||
.unwrap()
|
||||
.into(),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
UIRequest::Skip(skip_direction) => todo!(),
|
||||
UIRequest::Search(request) => {
|
||||
println!("got a: {:?}", request);
|
||||
|
@ -140,6 +164,7 @@ fn main() {
|
|||
sockets[i]
|
||||
.write_message(
|
||||
serde_json::to_string(&ServerResponse {
|
||||
message: "Here are the results:".to_string(),
|
||||
search_results: items,
|
||||
})
|
||||
.unwrap()
|
||||
|
|
|
@ -75,6 +75,7 @@ impl PartialTag {
|
|||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ServerResponse {
|
||||
pub message: String,
|
||||
pub search_results: Vec<ItemTag>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue