From a0931eebbde9f8ccfa05f94e35b5a8bbddc4d3bb Mon Sep 17 00:00:00 2001 From: 4gray Date: Sat, 7 Dec 2024 16:27:57 +0100 Subject: [PATCH] feat(epg): port multi-epg feature ot tauri --- src-tauri/src/commands/epg.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src-tauri/src/commands/epg.rs diff --git a/src-tauri/src/commands/epg.rs b/src-tauri/src/commands/epg.rs new file mode 100644 index 000000000..fea4d50cd --- /dev/null +++ b/src-tauri/src/commands/epg.rs @@ -0,0 +1,31 @@ +use crate::epg::{self, EpgChannelWithPrograms, Program}; + +#[tauri::command] +pub async fn fetch_epg(url: Vec) -> 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, 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, +) -> Result, String> { + epg::get_epg_by_range(start_time, end_time, skip, limit, playlist_channel_names) + .await + .map_err(|e| e.to_string()) +}