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("Pandora") => ActiveApp::Pandora,
|
||||||
Some("Spotify") => ActiveApp::Spotify,
|
Some("Spotify") => ActiveApp::Spotify,
|
||||||
Some("Plex") => ActiveApp::Plex,
|
Some("Plex") => ActiveApp::Plex,
|
||||||
|
Some("Crunchyroll") => ActiveApp::Crunchyroll,
|
||||||
|
Some("Funimation") => ActiveApp::Funimation,
|
||||||
|
Some("VRV") => ActiveApp::VRV,
|
||||||
_ => ActiveApp::Nothing,
|
_ => ActiveApp::Nothing,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@ impl Configuration {
|
|||||||
self.active_app == self.get_app_status()
|
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) {
|
pub fn change_active_app(&mut self, app_text: &String) {
|
||||||
self.active_app = app_text.to_string();
|
self.active_app = app_text.to_string();
|
||||||
}
|
}
|
||||||
|
28
src/main.rs
28
src/main.rs
@ -23,7 +23,6 @@ fn main() {
|
|||||||
loop {
|
loop {
|
||||||
println!("{:?}", configuration);
|
println!("{:?}", configuration);
|
||||||
|
|
||||||
|
|
||||||
let power_text = configuration.get_power_status();
|
let power_text = configuration.get_power_status();
|
||||||
configuration.change_power(&power_text);
|
configuration.change_power(&power_text);
|
||||||
let tvpower = app::match_to_power_status(power_text);
|
let tvpower = app::match_to_power_status(power_text);
|
||||||
@ -67,13 +66,37 @@ fn main() {
|
|||||||
ws.write(brightness(data.iter().cloned(), 32))
|
ws.write(brightness(data.iter().cloned(), 32))
|
||||||
.unwrap();
|
.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 => {
|
app::ActiveApp::Spotify => {
|
||||||
let data = change_color(&51, &255, &85);
|
let data = change_color(&51, &255, &85);
|
||||||
ws.write(brightness(data.iter().cloned(), 32))
|
ws.write(brightness(data.iter().cloned(), 32))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
},
|
},
|
||||||
app::ActiveApp::Plex => {
|
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);
|
let data = change_color(&255, &187, &51);
|
||||||
ws.write(brightness(data.iter().cloned(), 32))
|
ws.write(brightness(data.iter().cloned(), 32))
|
||||||
.unwrap();
|
.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);
|
let sec = time::Duration::from_secs(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user