diff --git a/src/app.rs b/src/app.rs index 21b59c9..5a68ef4 100644 --- a/src/app.rs +++ b/src/app.rs @@ -24,8 +24,7 @@ impl eframe::App for App { ui.label("Made by ya boi, lza_menace"); ui.hyperlink("https://lzahq.tech"); - ui.separator(); - ui.label(format!("Now Playing: ")); + ui.separator(); ui.horizontal(|ui| { if ui.button("▶").clicked() { // If stream thread is done, start again @@ -38,16 +37,20 @@ impl eframe::App for App { let _ = &self.player.sink.append(source); } let _ = &self.player.sink.play(); + self.player.playing = true; } if ui.button("■").clicked() { let _ = &self.player.sink.pause(); + self.player.playing = false; } }); ui.add(egui::Slider::new(&mut self.player.volume, 0.0..=100.0).text("Volume")); self.player.sink.set_volume(self.player.volume / 100.0); - - ui.label(format!("{:?}", self.player.get_song_meta())); + if self.player.playing { + ui.label(format!("Now Playing: {:?}", self.player.get_song_meta())); + } + // ui.separator(); // ui.heading("Tor"); diff --git a/src/player.rs b/src/player.rs index 84d69fb..eb7107f 100644 --- a/src/player.rs +++ b/src/player.rs @@ -3,7 +3,9 @@ pub struct Player { pub sink: rodio::Sink, pub stream_thread: std::thread::JoinHandle<()>, pub stream_handle: rodio::OutputStreamHandle, - pub volume: f32 + pub volume: f32, + pub stream_exif: String, + pub playing: bool } impl Player { @@ -12,7 +14,9 @@ impl Player { sink, stream_handle, stream_thread: std::thread::spawn(|| {}), - volume: 100.0 + volume: 100.0, + stream_exif: "".to_owned(), + playing: false } }