removed feature skeleton
This commit is contained in:
parent
d4b35c4e9b
commit
bf2fc2181f
1 changed files with 17 additions and 21 deletions
28
src/main.rs
28
src/main.rs
|
@ -50,7 +50,6 @@ struct CliArgs {
|
|||
value_parser(["title", "artist", "album"]),
|
||||
)]
|
||||
field: String,
|
||||
|
||||
// Add flag for "search filepaths too" for music lacking metadata
|
||||
}
|
||||
|
||||
|
@ -67,11 +66,14 @@ fn main() {
|
|||
SousaCommands::Play => serde_json::to_string(&UIRequest::Play).unwrap(),
|
||||
SousaCommands::Pause => serde_json::to_string(&UIRequest::Pause).unwrap(),
|
||||
SousaCommands::Search => {
|
||||
let request = UIRequest::Search(parse_to_partialtag(cli.field, cli.search_arg.unwrap()).unwrap());
|
||||
let request =
|
||||
UIRequest::Search(parse_to_partialtag(cli.field, cli.search_arg.unwrap()).unwrap());
|
||||
serde_json::to_string(&request).unwrap()
|
||||
}
|
||||
SousaCommands::SwitchTo => {
|
||||
let request = UIRequest::SwitchTo(parse_to_partialtag(cli.field, cli.search_arg.unwrap()).unwrap());
|
||||
let request = UIRequest::SwitchTo(
|
||||
parse_to_partialtag(cli.field, cli.search_arg.unwrap()).unwrap(),
|
||||
);
|
||||
serde_json::to_string(&request).unwrap()
|
||||
}
|
||||
SousaCommands::StatusUpdate => {
|
||||
|
@ -85,18 +87,14 @@ fn main() {
|
|||
.expect("Error sending message");
|
||||
let server_message = socket.read_message().expect("Error reading message");
|
||||
|
||||
let server_response: message_types::ServerResponse = match serde_json::from_str(server_message.clone().into_text().unwrap().as_str()) {
|
||||
Ok(sr) => sr,
|
||||
Err(error) => {
|
||||
println!("\n\nThere was an error decoding the message from the server");
|
||||
println!("\nThe Message was: {}", server_message);
|
||||
println!("\n\n {}", error);
|
||||
socket.close(None).unwrap();
|
||||
return ();
|
||||
}
|
||||
};
|
||||
if server_message.is_empty() {
|
||||
socket.close(None).unwrap();
|
||||
panic!("The server returned nothing");
|
||||
}
|
||||
|
||||
let server_response: message_types::ServerResponse =
|
||||
serde_json::from_str(server_message.clone().into_text().unwrap().as_str()).unwrap();
|
||||
|
||||
println!("{}", server_response.message.clone());
|
||||
if server_response
|
||||
.message
|
||||
.starts_with("Multiple results found")
|
||||
|
@ -197,7 +195,6 @@ fn parse_to_partialtag(field: String, value: String) -> Result<PartialTag, Strin
|
|||
}
|
||||
|
||||
impl ServerResponse {
|
||||
|
||||
/// Prints
|
||||
fn pretty_print(self: &Self) -> () {
|
||||
let mut table = Table::new(vec![
|
||||
|
@ -217,7 +214,6 @@ impl ServerResponse {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_partialtag() {
|
||||
let partial_tag = parse_to_partialtag("title".to_string(), "Rocker Song".to_string()).unwrap();
|
||||
|
|
Loading…
Reference in a new issue