added some apps, some code cleanup
apps added include the following: Amazon Prime, Pandora, Crunchyroll, Funimation, and VRV
This commit is contained in:
parent
b652eedede
commit
c8b3892389
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
28
src/main.rs
28
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,7 +66,16 @@ 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))
|
||||
@ -78,11 +86,25 @@ fn main() {
|
||||
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();
|
||||
},
|
||||
_ => println!("We don't know what app is running right now..."),
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => println!("We don't know what the power status of the TV is..."),
|
||||
}
|
||||
|
||||
let sec = time::Duration::from_secs(1);
|
||||
|
Loading…
Reference in New Issue
Block a user