remove fancy player

This commit is contained in:
2025-08-12 20:11:57 +02:00
parent 240f7d7f8d
commit 3d252a2604
4 changed files with 4 additions and 141 deletions

44
Cargo.lock generated
View File

@@ -689,30 +689,6 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
[[package]]
name = "maud"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8156733e27020ea5c684db5beac5d1d611e1272ab17901a49466294b84fc217e"
dependencies = [
"axum-core",
"http",
"itoa",
"maud_macros",
]
[[package]]
name = "maud_macros"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7261b00f3952f617899bc012e3dbd56e4f0110a038175929fa5d18e5a19913ca"
dependencies = [
"proc-macro2",
"proc-macro2-diagnostics",
"quote",
"syn",
]
[[package]]
name = "mediatype"
version = "0.20.0"
@@ -824,13 +800,11 @@ dependencies = [
"axum",
"bytes",
"chrono",
"maud",
"reqwest",
"serde_json",
"stream-download",
"tokio",
"tokio-stream",
"tracing",
]
[[package]]
@@ -860,18 +834,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "proc-macro2-diagnostics"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "quinn"
version = "0.11.8"
@@ -1519,12 +1481,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "want"
version = "0.3.1"

View File

@@ -11,7 +11,5 @@ reqwest = { version = "0.12", features = ["stream", "json", "rustls-tls"], defau
bytes = "1"
async-stream = "0.3"
serde_json = "1"
tracing = "0.1"
stream-download = "0.22"
chrono = "0.4"
maud = { version = "0.27", features = ["axum"] }

View File

@@ -16,7 +16,8 @@ async fn get_newest_morning_journal() -> Result<String, Box<dyn std::error::Erro
for day in days.iter().rev() {
if let Some(broadcasts) = day["broadcasts"].as_array() {
for broadcast in broadcasts.iter().rev() {
if broadcast["title"] == "Ö1 Morgenjournal" {
//if broadcast["title"] == "Ö1 Morgenjournal" {
if broadcast["title"] == "Eröffnungskonzert Allegro Vivo" {
if let Some(href) = broadcast["href"].as_str() {
return Ok(href.into());
}

View File

@@ -1,108 +1,16 @@
mod state;
mod streamer;
use axum::{response::IntoResponse, routing::get, Router};
use maud::{html, Markup, DOCTYPE};
use reqwest::header;
use axum::{routing::get, Router};
use state::AppState;
use std::sync::Arc;
async fn index() -> Markup {
html! {
(DOCTYPE)
html lang="en" {
head {
meta charset="utf-8";
meta name="viewport" content="user-scalable=no";
title { "Ö1 Morgenjournal" }
link rel="stylesheet" href="/styles.css";
}
body {
// Top Info
div #title {
span #track {}
div #timer { "0:00" }
div #duration { "0:00" }
}
// Controls
div .controlsOuter {
div .controlsInner {
div #loading {}
div .btn #playBtn {}
div .btn #pauseBtn {}
div .btn #prevBtn {}
div .btn #nextBtn {}
}
div .btn #playlistBtn {}
div .btn #volumeBtn {}
}
// Progress
div #waveform {}
div #bar {}
div #progress {}
// Playlist
div #playlist {
div #list {}
}
// Volume
div #volume .fadeout {
div #barFull .bar {}
div #barEmpty .bar {}
div #sliderBtn {}
}
// Scripts
script src="/howler.core.min.js" {}
script src="/siriwave.js" {}
script src="/player.js" {}
}
}
}
}
async fn styles() -> impl IntoResponse {
(
[(header::CONTENT_TYPE, "text/css")],
include_str!("../static/styles.css"),
)
}
async fn howler() -> impl IntoResponse {
(
[(header::CONTENT_TYPE, "text/javascript")],
include_str!("../static/howler.core.min.js").to_string(),
)
}
async fn player() -> impl IntoResponse {
(
[(header::CONTENT_TYPE, "text/javascript")],
include_str!("../static/player.js").to_string(),
)
}
async fn siriwave() -> impl IntoResponse {
(
[(header::CONTENT_TYPE, "text/javascript")],
include_str!("../static/siriwave.js").to_string(),
)
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let state = Arc::new(AppState::new());
let app = Router::new()
.route("/", get(index))
.route("/stream", get(streamer::stream_handler))
.route("/howler.core.min.js", get(howler))
.route("/styles.css", get(styles))
.route("/player.js", get(player))
.route("/siriwave.js", get(siriwave))
.route("/", get(streamer::stream_handler))
.with_state(state);
println!("Streaming server running on http://localhost:3029");