From: Stephen Seo Date: Tue, 14 Dec 2021 10:15:23 +0000 (+0900) Subject: WIP actually use "error_text" in MPDHandler X-Git-Tag: 0.2.0~23 X-Git-Url: https://git.seodisparate.com/stephenseo/css/base.css?a=commitdiff_plain;h=a1e692bb2daad61723faca53bcf717d54c23dfb7;p=mpd_info_screen WIP actually use "error_text" in MPDHandler --- diff --git a/src/mpd_handler.rs b/src/mpd_handler.rs index 546f7c2..7369a8a 100644 --- a/src/mpd_handler.rs +++ b/src/mpd_handler.rs @@ -424,20 +424,25 @@ impl MPDHandler { PollState::Password => { write_handle.can_authenticate = false; write_handle.dirty_flag.store(true, Ordering::Relaxed); + write_handle.error_text = "Failed to authenticate to MPD".into(); } PollState::CurrentSong | PollState::Status => { write_handle.can_get_status = false; write_handle.dirty_flag.store(true, Ordering::Relaxed); + write_handle.error_text = "Failed to get MPD status".into(); } PollState::ReadPicture => { write_handle.can_get_album_art = false; write_handle.dirty_flag.store(true, Ordering::Relaxed); println!("Failed to get readpicture"); + // Not setting error_text here since + // ReadPictureInDir is tried next } PollState::ReadPictureInDir => { write_handle.can_get_album_art_in_dir = false; write_handle.dirty_flag.store(true, Ordering::Relaxed); println!("Failed to get albumart"); + write_handle.error_text = "Failed to get album art from MPD".into(); } _ => (), } @@ -456,6 +461,7 @@ impl MPDHandler { write_handle.current_song_position = 0.0; write_handle.did_check_overtime = false; write_handle.force_get_status = true; + write_handle.error_text.clear(); } write_handle.dirty_flag.store(true, Ordering::Relaxed); write_handle.song_title_get_time = Instant::now();