Fixed invalid epg text content parsing

This commit is contained in:
euzu
2025-10-01 16:40:22 +02:00
parent d76375e4a8
commit 38b1cd6d31
9 changed files with 217 additions and 122 deletions
+4 -4
View File
@@ -153,11 +153,11 @@ impl EpgIdCache<'_> {
/// let mut id_cache = EpgIdCache::new(None);
/// assign_channel_epg(&mut new_epg, &mut playlist, &mut id_cache);
/// ```
fn assign_channel_epg(new_epg: &mut Vec<Epg>, fp: &mut FetchedPlaylist, id_cache: &mut EpgIdCache) {
async fn assign_channel_epg(new_epg: &mut Vec<Epg>, fp: &mut FetchedPlaylist<'_>, id_cache: &mut EpgIdCache<'_>) {
//id_cache.normalized.retain(|_, v| v.is_some());
if let Some(tv_guide) = &fp.epg {
let mut processed_epgs = vec![];
if let Some(epg_sources) = tv_guide.filter(id_cache) {
if let Some(epg_sources) = tv_guide.filter(id_cache).await {
let mut icon_assigned = HashSet::new();
for epg_source in epg_sources {
// icon tags
@@ -236,7 +236,7 @@ fn assign_channel_epg(new_epg: &mut Vec<Epg>, fp: &mut FetchedPlaylist, id_cache
/// let mut epg_data = Vec::new();
/// process_playlist_epg(&mut playlist, &mut epg_data);
/// ```
pub fn process_playlist_epg(fp: &mut FetchedPlaylist, epg: &mut Vec<Epg>) {
pub async fn process_playlist_epg(fp: &mut FetchedPlaylist<'_>, epg: &mut Vec<Epg>) {
// collect all epg_channel ids
let mut id_cache = EpgIdCache::new(fp.input.epg.as_ref());
id_cache.collect_epg_id(fp);
@@ -244,7 +244,7 @@ pub fn process_playlist_epg(fp: &mut FetchedPlaylist, epg: &mut Vec<Epg>) {
if id_cache.is_empty() && !id_cache.smart_match_enabled {
debug!("No epg ids found");
} else {
assign_channel_epg(epg, fp, &mut id_cache);
assign_channel_epg(epg, fp, &mut id_cache).await;
}
}
+3 -3
View File
@@ -499,7 +499,7 @@ async fn process_playlist_for_target(app_config: &AppConfig,
processed_fetched_playlists.push(processed_fpl);
}
step.tick("filter rename map");
let (new_epg, mut new_playlist) = process_epg(&mut processed_fetched_playlists);
let (new_epg, mut new_playlist) = process_epg(&mut processed_fetched_playlists).await;
step.tick("epg");
if new_playlist.is_empty() {
@@ -552,14 +552,14 @@ async fn trakt_playlist(client: &Arc<Client>, target: &ConfigTarget, errors: &mu
true
}
fn process_epg(processed_fetched_playlists: &mut Vec<FetchedPlaylist>) -> (Vec<Epg>, Vec<PlaylistGroup>) {
async fn process_epg(processed_fetched_playlists: &mut Vec<FetchedPlaylist<'_>>) -> (Vec<Epg>, Vec<PlaylistGroup>) {
let mut new_playlist = vec![];
let mut new_epg = vec![];
// each fetched playlist can have its own epgl url.
// we need to process each input epg.
for fp in processed_fetched_playlists {
process_playlist_epg(fp, &mut new_epg);
process_playlist_epg(fp, &mut new_epg).await;
new_playlist.append(&mut fp.playlistgroups);
}
(new_epg, new_playlist)