Visualise muted media player
This commit is contained in:
parent
ae1a579aa2
commit
6ffcd126e4
1 changed files with 4 additions and 1 deletions
|
@ -226,8 +226,11 @@ impl HomeAssistant {
|
||||||
let artist = attributes["media_artist"].as_str().unwrap_or("No artist");
|
let artist = attributes["media_artist"].as_str().unwrap_or("No artist");
|
||||||
let title = attributes["media_title"].as_str().unwrap_or("No title");
|
let title = attributes["media_title"].as_str().unwrap_or("No title");
|
||||||
let volume_raw = attributes["volume_level"].as_f64().unwrap_or(-1.);
|
let volume_raw = attributes["volume_level"].as_f64().unwrap_or(-1.);
|
||||||
|
let is_muted = attributes["is_volume_muted"].as_bool().unwrap_or(false);
|
||||||
|
|
||||||
let volume = if volume_raw >= 0. {
|
let volume = if is_muted {
|
||||||
|
String::from("[ ﱝ ]")
|
||||||
|
} else if volume_raw >= 0. {
|
||||||
format!("[{:3.0}%] ", volume_raw * 100.)
|
format!("[{:3.0}%] ", volume_raw * 100.)
|
||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
|
|
Loading…
Reference in a new issue