From f1997d1d169d44497c94513f2c7a311bd679fb5c Mon Sep 17 00:00:00 2001 From: wilson Date: Mon, 24 Jun 2024 00:14:11 +0800 Subject: [PATCH] reset lyrics after song finished --- src/lyrics.rs | 12 +++++++----- src/main.rs | 6 ++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lyrics.rs b/src/lyrics.rs index 2da7634..0d759a2 100644 --- a/src/lyrics.rs +++ b/src/lyrics.rs @@ -181,11 +181,13 @@ mod xosd { #[inline(always)] fn reset(&mut self) -> std::result::Result<(), Self::Error> { - show(&mut self.prev, None)?; - show(&mut self.curr, None)?; - show(&mut self.next, None)?; - - self.showing = false; + if self.showing { + show(&mut self.prev, None)?; + show(&mut self.curr, None)?; + show(&mut self.next, None)?; + + self.showing = false; + } Ok(()) } diff --git a/src/main.rs b/src/main.rs index e521595..092452b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -244,6 +244,12 @@ impl App { } } PlayerState::Finished => { + if let Some(lyrics) = &mut app.lyrics { + if let Err(e) = lyrics.reset() { + println!("RUST-ERROR: Failed to reset lyrics {}", e) + } + } + app.player.idle(); if app.stop_next {