first draft of new version
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m18s
CI/CD Pipeline / deploy (push) Successful in 1m17s

This commit is contained in:
Philipp Hofer
2025-10-13 15:04:31 +02:00
parent 4093a89f62
commit 6c84f98c31

View File

@@ -18,12 +18,13 @@ impl Feed {
pub async fn fetch(&mut self) -> Result<(), Box<dyn std::error::Error>> { pub async fn fetch(&mut self) -> Result<(), Box<dyn std::error::Error>> {
let broadcasts = get_all_broadcasts().await?; let broadcasts = get_all_broadcasts().await?;
println!("hea");
for broadcast in broadcasts { for broadcast in broadcasts {
if !self.has_broadcast_url(&broadcast) { if !self.has_broadcast_url(&broadcast) {
if let Ok(Some(broadcast)) = Broadcast::from(broadcast).await { if let Some(broadcast) = Broadcast::from(broadcast).await.unwrap() {
self.episodes.push(broadcast); self.episodes.push(broadcast);
} else {
return Ok(());
} }
} }
} }
@@ -79,8 +80,11 @@ async fn get_all_broadcasts() -> Result<Vec<String>, Box<dyn std::error::Error>>
for day in days { for day in days {
if let Some(broadcasts) = day["broadcasts"].as_array() { if let Some(broadcasts) = day["broadcasts"].as_array() {
for broadcast in broadcasts { for broadcast in broadcasts {
// if broadcast["title"] in []; if ["Ö1 Morgenjournal", "Ö1 Mittagsjournal", "Ö1 Abendjournal"]
ret.push(broadcast["href"].to_string()); .contains(&broadcast["title"].as_str().unwrap())
{
ret.push(broadcast["href"].as_str().unwrap().into());
}
} }
} }
} }