feat(epg): port multi-epg feature ot tauri

This commit is contained in:
4gray committed 2024-12-07 16:27:57 +01:00
1 parent 15da94c662
commit a0931eebbd
1 file changed
+31
+31
View File
@@ -0,0 +1,31 @@
use crate::epg::{self, EpgChannelWithPrograms, Program};
#[tauri::command]
pub async fn fetch_epg(url: Vec<String>) -> Result<(), String> {
for single_url in url {
epg::fetch_and_parse_epg(single_url)
.await
.map_err(|e| e.to_string())?;
}
Ok(())
}
#[tauri::command]
pub async fn get_channel_programs(channel_id: String) -> Result<Vec<Program>, String> {
epg::get_programs_by_channel(channel_id)
.await
.map_err(|e| e.to_string())
}
#[tauri::command]
pub async fn get_epg_by_range(
start_time: String,
end_time: String,
skip: usize,
limit: usize,
playlist_channel_names: Vec<String>,
) -> Result<Vec<EpgChannelWithPrograms>, String> {
epg::get_epg_by_range(start_time, end_time, skip, limit, playlist_channel_names)
.await
.map_err(|e| e.to_string())
}