From c8b38923891aba03c282fe843765b9a5ccf9501b Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sat, 23 May 2020 21:25:11 +0100 Subject: [PATCH] added some apps, some code cleanup apps added include the following: Amazon Prime, Pandora, Crunchyroll, Funimation, and VRV --- src/app.rs | 3 +++ src/config.rs | 4 ---- src/main.rs | 28 +++++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/app.rs b/src/app.rs index 1ca2ba3..8c70cdd 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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, } } diff --git a/src/config.rs b/src/config.rs index 11a8786..3ba16c2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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(); } diff --git a/src/main.rs b/src/main.rs index a72fd62..a681d70 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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);