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"]),
|
value_parser(["title", "artist", "album"]),
|
||||||
)]
|
)]
|
||||||
field: String,
|
field: String,
|
||||||
|
|
||||||
// Add flag for "search filepaths too" for music lacking metadata
|
// 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::Play => serde_json::to_string(&UIRequest::Play).unwrap(),
|
||||||
SousaCommands::Pause => serde_json::to_string(&UIRequest::Pause).unwrap(),
|
SousaCommands::Pause => serde_json::to_string(&UIRequest::Pause).unwrap(),
|
||||||
SousaCommands::Search => {
|
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()
|
serde_json::to_string(&request).unwrap()
|
||||||
}
|
}
|
||||||
SousaCommands::SwitchTo => {
|
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()
|
serde_json::to_string(&request).unwrap()
|
||||||
}
|
}
|
||||||
SousaCommands::StatusUpdate => {
|
SousaCommands::StatusUpdate => {
|
||||||
|
@ -85,18 +87,14 @@ fn main() {
|
||||||
.expect("Error sending message");
|
.expect("Error sending message");
|
||||||
let server_message = socket.read_message().expect("Error reading 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()) {
|
if server_message.is_empty() {
|
||||||
Ok(sr) => sr,
|
socket.close(None).unwrap();
|
||||||
Err(error) => {
|
panic!("The server returned nothing");
|
||||||
println!("\n\nThere was an error decoding the message from the server");
|
}
|
||||||
println!("\nThe Message was: {}", server_message);
|
|
||||||
println!("\n\n {}", error);
|
let server_response: message_types::ServerResponse =
|
||||||
socket.close(None).unwrap();
|
serde_json::from_str(server_message.clone().into_text().unwrap().as_str()).unwrap();
|
||||||
return ();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
println!("{}", server_response.message.clone());
|
|
||||||
if server_response
|
if server_response
|
||||||
.message
|
.message
|
||||||
.starts_with("Multiple results found")
|
.starts_with("Multiple results found")
|
||||||
|
@ -197,7 +195,6 @@ fn parse_to_partialtag(field: String, value: String) -> Result<PartialTag, Strin
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerResponse {
|
impl ServerResponse {
|
||||||
|
|
||||||
/// Prints
|
/// Prints
|
||||||
fn pretty_print(self: &Self) -> () {
|
fn pretty_print(self: &Self) -> () {
|
||||||
let mut table = Table::new(vec![
|
let mut table = Table::new(vec![
|
||||||
|
@ -217,7 +214,6 @@ impl ServerResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_partialtag() {
|
fn test_partialtag() {
|
||||||
let partial_tag = parse_to_partialtag("title".to_string(), "Rocker Song".to_string()).unwrap();
|
let partial_tag = parse_to_partialtag("title".to_string(), "Rocker Song".to_string()).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue