Skip to content

Commit

Permalink
reset lyrics after song finished
Browse files Browse the repository at this point in the history
  • Loading branch information
feois committed Jun 23, 2024
1 parent fe25457 commit f1997d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/lyrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f1997d1

Please sign in to comment.