get it working again

irc-tor
lza_menace 2 years ago
parent b99a0ca657
commit a8a57d61f0

@ -97,7 +97,7 @@ impl eframe::App for App {
}
});
if self.tor_connected {
// if self.tor_connected {
egui::TopBottomPanel::bottom("radio_player").show(ctx, |ui| {
ui.heading(egui::RichText::new("WOW!Radio").color(egui::Color32::GREEN));
ui.label(egui::RichText::new("Your home for the most diabolical playlist of the century, \nmade by the skeevers, scallywags, chupacabras, and whores\n of the Wownero community. Join da chat to peep da scoop.\n").color(egui::Color32::GREEN));
@ -134,8 +134,8 @@ impl eframe::App for App {
ui.label("\n");
}
});
} else {
// } else {
//
}
// }
}
}

@ -16,7 +16,7 @@ impl Player {
sink,
stream_handle,
stream_thread: std::thread::spawn(|| {}),
stream_source: "http://wowradiod6mhb4ignjqy5ghf5l42yh2yeumgeq3yi7gn7yqy3efhe5ad.onion".to_owned(),
stream_source: "https://radio.wownero.com/wow.ogg".to_owned(),
stream_exif: "".to_owned(),
volume: 100.0,
playing: false
@ -30,31 +30,20 @@ impl Player {
}
pub fn check_radio_stream(&self) -> bool {
let url = format!("{}/wow.ogg", self.stream_source);
let res = reqwest::blocking::Client::builder()
.proxy(reqwest::Proxy::http("socks5://127.0.0.1:19050").unwrap())
.build()
.unwrap()
.get(url)
.send();
match res {
Ok(r) => r.status().is_success(),
Err(_e) => false
let res: reqwest::blocking::Response = reqwest::blocking::get(self.stream_source.clone()).expect("request failed");
if res.status().is_success() {
true
} else {
false
}
}
pub fn start_radio_stream(&self) -> std::thread::JoinHandle<()> {
let url = format!("{}/wow.ogg", self.stream_source);
let url = self.stream_source.clone();
let t: Result<std::thread::JoinHandle<()>, std::io::Error> = std::thread::Builder::new().name("radio_stream".to_string()).spawn(move || {
let res: Result<reqwest::blocking::Response, reqwest::Error> = reqwest::blocking::Client::builder()
.proxy(reqwest::Proxy::http("socks5://127.0.0.1:19050").unwrap())
.timeout(std::time::Duration::from_secs(15))
.build()
.unwrap()
.get(url)
.send();
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.unwrap(), &mut out).expect("failed to copy content");
std::io::copy(&mut res, &mut out).expect("failed to copy content");
});
return t.unwrap()
}