added some apps, some code cleanup

apps added include the following: Amazon Prime, Pandora, Crunchyroll, Funimation, and VRV
This commit is contained in:
Wyatt J. Miller 2020-05-23 21:25:11 +01:00
parent b652eedede
commit c8b3892389
3 changed files with 28 additions and 7 deletions

View File

@ -41,6 +41,9 @@ pub fn match_to_app(text: String) -> ActiveApp {
Some("Pandora") => ActiveApp::Pandora,
Some("Spotify") => ActiveApp::Spotify,
Some("Plex") => ActiveApp::Plex,
Some("Crunchyroll") => ActiveApp::Crunchyroll,
Some("Funimation") => ActiveApp::Funimation,
Some("VRV") => ActiveApp::VRV,
_ => ActiveApp::Nothing,
}
}

View File

@ -21,10 +21,6 @@ impl Configuration {
self.active_app == self.get_app_status()
}
pub fn is_change_power(&self) -> bool {
self.power_status == self.get_power_status()
}
pub fn change_active_app(&mut self, app_text: &String) {
self.active_app = app_text.to_string();
}

View File

@ -23,7 +23,6 @@ fn main() {
loop {
println!("{:?}", configuration);
let power_text = configuration.get_power_status();
configuration.change_power(&power_text);
let tvpower = app::match_to_power_status(power_text);
@ -67,13 +66,37 @@ fn main() {
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::AmazonPrime => println!("The light are light blue!"),
app::ActiveApp::AmazonPrime => {
let data = change_color(&99, &123, &255);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::Pandora => {
let data = change_color(&99, &123, &255);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::Spotify => {
let data = change_color(&51, &255, &85);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::Plex => {
let data = change_color(&255, &187, &51);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::Crunchyroll => {
let data = change_color(&255, &187, &51);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::Funimation => {
let data = change_color(&255, &0, &255);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
},
app::ActiveApp::VRV => {
let data = change_color(&255, &187, &51);
ws.write(brightness(data.iter().cloned(), 32))
.unwrap();
@ -82,7 +105,6 @@ fn main() {
}
}
},
_ => println!("We don't know what the power status of the TV is..."),
}
let sec = time::Duration::from_secs(1);