2019-12-28 21:42:24 -06:00
|
|
|
// enum used when a certain TV app is being used
|
2019-12-29 19:58:49 -06:00
|
|
|
pub enum ActiveApp {
|
|
|
|
Roku,
|
2019-12-28 21:42:24 -06:00
|
|
|
Netflix,
|
|
|
|
Hulu,
|
|
|
|
AmazonPrime,
|
2019-12-29 19:58:49 -06:00
|
|
|
Plex,
|
2019-12-28 21:42:24 -06:00
|
|
|
Pandora,
|
|
|
|
Spotify,
|
|
|
|
Crunchyroll,
|
|
|
|
Funimation,
|
|
|
|
VRV,
|
|
|
|
}
|
|
|
|
|
|
|
|
// enum used to select what kind of TV you are using
|
2020-01-03 22:15:13 -06:00
|
|
|
// not used atm
|
2019-12-29 19:58:49 -06:00
|
|
|
pub enum TV {
|
2019-12-28 21:42:24 -06:00
|
|
|
Roku,
|
|
|
|
Android,
|
|
|
|
Samsung,
|
|
|
|
Amazon,
|
|
|
|
}
|
2019-12-29 19:58:49 -06:00
|
|
|
|
2020-01-03 22:15:13 -06:00
|
|
|
pub enum TVPower {
|
|
|
|
On,
|
|
|
|
Off,
|
|
|
|
}
|
|
|
|
|
2019-12-29 19:58:49 -06:00
|
|
|
pub fn match_to_app(text: String) -> ActiveApp {
|
|
|
|
let mut result = text.split_whitespace();
|
|
|
|
|
|
|
|
match result.next() {
|
|
|
|
Some("Roku") => ActiveApp::Roku,
|
|
|
|
Some("Netflix") => ActiveApp::Netflix,
|
|
|
|
Some("Hulu") => ActiveApp::Hulu,
|
|
|
|
Some("Prime") => ActiveApp::AmazonPrime,
|
|
|
|
Some("Plex") => ActiveApp::Plex,
|
|
|
|
Some("Pandora") => ActiveApp::Pandora,
|
|
|
|
Some("Spotify") => ActiveApp::Spotify,
|
2020-01-24 16:08:10 -06:00
|
|
|
Some("Plex") => ActiveApp::Plex,
|
2019-12-29 19:58:49 -06:00
|
|
|
_ => ActiveApp::Roku,
|
|
|
|
}
|
|
|
|
}
|
2020-01-03 22:15:13 -06:00
|
|
|
|
|
|
|
pub fn match_to_power_status(text: String) -> TVPower {
|
|
|
|
match text.trim() {
|
|
|
|
"PowerOn" => TVPower::On,
|
|
|
|
_ => TVPower::Off,
|
|
|
|
}
|
|
|
|
}
|