epg id is now case insensitive

This commit is contained in:
euzu
2025-03-28 22:40:41 +01:00
parent 5842e00ed4
commit e4902c0624
5 changed files with 24 additions and 11 deletions
+2 -1
View File
@@ -128,7 +128,8 @@ fn process_header(input: &ConfigInput, video_suffixes: &[&str], content: &str, u
}
}
// plih.virtual_id = plih.id;
plih.epg_channel_id = Some(plih.id.to_string());
plih.epg_channel_id = Some(plih.id.to_lowercase().to_string());
}
if video_suffixes.iter().any(|suffix| url.ends_with(suffix)) {
+11 -3
View File
@@ -60,12 +60,20 @@ where
match reader.read_event_into(&mut buf) {
Ok(Event::Eof) => break,
Ok(Event::Start(e)) => {
let name = String::from_utf8_lossy(e.name().as_ref()).to_string();
let is_tv_tag = name == EPG_TAG_TV;
let name = String::from_utf8_lossy(e.name().as_ref()).as_ref().to_owned();
let (is_tv_tag, is_channel, is_program) = match name.as_str() {
EPG_TAG_TV => (true, false, false),
EPG_TAG_CHANNEL => (false, true, false),
EPG_TAG_PROGRAMME => (false, false, true),
_ => (false, false, false)
};
let attributes = e.attributes().filter_map(Result::ok)
.filter_map(|a| {
let key = String::from_utf8_lossy(a.key.as_ref()).to_string();
let value = String::from(a.unescape_value().unwrap().as_ref());
let mut value = String::from(a.unescape_value().unwrap().as_ref());
if (is_channel && key == EPG_ATTRIB_ID) || (is_program && key == EPG_ATTRIB_CHANNEL) {
value = value.to_lowercase().to_string();
}
if value.is_empty() {
None
} else {
+1 -1
View File
@@ -148,7 +148,7 @@ pub fn parse_xtream(input: &ConfigInput,
group: category_name.to_string(),
title: stream.name.to_string(),
url: stream_url.to_string(),
epg_channel_id: stream.epg_channel_id.clone(),
epg_channel_id: stream.epg_channel_id.as_ref().map(|id| id.to_lowercase().to_string()),
item_type,
xtream_cluster,
additional_properties: stream.get_additional_properties(),