diff --git a/src/app.rs b/src/app.rs index 5a68ef4..6a4ef83 100644 --- a/src/app.rs +++ b/src/app.rs @@ -49,6 +49,7 @@ impl eframe::App for App { self.player.sink.set_volume(self.player.volume / 100.0); if self.player.playing { ui.label(format!("Now Playing: {:?}", self.player.get_song_meta())); + ui.label(format!("Stream URL: {:?}", self.player.stream_source)); } diff --git a/src/player.rs b/src/player.rs index eb7107f..cc77b4f 100644 --- a/src/player.rs +++ b/src/player.rs @@ -3,8 +3,9 @@ pub struct Player { pub sink: rodio::Sink, pub stream_thread: std::thread::JoinHandle<()>, pub stream_handle: rodio::OutputStreamHandle, - pub volume: f32, + pub stream_source: String, pub stream_exif: String, + pub volume: f32, pub playing: bool } @@ -14,8 +15,9 @@ impl Player { sink, stream_handle, stream_thread: std::thread::spawn(|| {}), - volume: 100.0, + stream_source: "https://radio.wownero.com/wow.ogg".to_owned(), stream_exif: "".to_owned(), + volume: 100.0, playing: false } } @@ -27,8 +29,9 @@ impl Player { } pub fn start_radio_stream(&self) -> std::thread::JoinHandle<()> { + let url: String = self.stream_source.clone(); let t: Result, std::io::Error> = std::thread::Builder::new().name("radio_stream".to_string()).spawn(move || { - let mut res: reqwest::blocking::Response = reqwest::blocking::get("https://radio.wownero.com/wow.ogg").expect("request failed"); + let mut res: reqwest::blocking::Response = reqwest::blocking::get(url).expect("request failed"); let mut out: std::fs::File = std::fs::File::create(&crate::RADIO_STREAM).expect("failed to create file"); std::io::copy(&mut res, &mut out).expect("failed to copy content"); });