2019-12-28 21:43:13 -06:00
|
|
|
// external crates getting imported
|
2019-12-29 19:58:49 -06:00
|
|
|
extern crate chrono;
|
|
|
|
extern crate reqwest;
|
|
|
|
extern crate select;
|
2019-12-28 21:43:13 -06:00
|
|
|
extern crate serde;
|
|
|
|
extern crate serde_derive;
|
|
|
|
extern crate serde_json;
|
2019-12-29 19:58:49 -06:00
|
|
|
extern crate time;
|
2019-12-28 21:43:13 -06:00
|
|
|
|
|
|
|
// actual third party library being imported
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use serde_json::Result;
|
2019-12-29 19:58:49 -06:00
|
|
|
use time::Duration;
|
2019-12-28 21:43:13 -06:00
|
|
|
|
|
|
|
// local files that need to be imported
|
|
|
|
mod app;
|
|
|
|
mod config;
|
|
|
|
mod generate;
|
|
|
|
|
2019-12-26 21:32:42 -06:00
|
|
|
fn main() {
|
2019-12-28 21:43:13 -06:00
|
|
|
let configuration = config::init_config();
|
2019-12-29 19:58:49 -06:00
|
|
|
println!("{:?}", configuration);
|
|
|
|
|
|
|
|
loop {
|
|
|
|
let text = config::get_tv_status(&configuration);
|
|
|
|
|
|
|
|
let activeapp = app::match_to_app(text);
|
|
|
|
|
|
|
|
match activeapp {
|
|
|
|
app::ActiveApp::Roku => println!("The lights are light purple!"),
|
|
|
|
app::ActiveApp::Netflix => println!("The lights are red!"),
|
|
|
|
app::ActiveApp::Hulu => println!("The lights are green!"),
|
|
|
|
app::ActiveApp::AmazonPrime => println!("The light are light blue!"),
|
|
|
|
app::ActiveApp::Spotify => println!("The lights are light green!"),
|
|
|
|
_ => println!("Oops!"),
|
|
|
|
}
|
|
|
|
|
|
|
|
time::Duration::seconds(1);
|
|
|
|
//println!("{:?}", text as str);
|
|
|
|
}
|
2019-12-26 21:32:42 -06:00
|
|
|
}
|