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
+1
View File
@@ -516,6 +516,7 @@ async fn xtream_get_short_epg(app_state: &AppState, user: &ProxyUserCredentials,
return redirect(&info_url).into_response();
}
// TODO serve epg from own db
return match request::download_text_content(Arc::clone(&app_state.http_client), input, info_url.as_str(), None).await {
Ok(content) => (axum::http::StatusCode::OK, axum::Json(content)).into_response(),
Err(err) => {
+9 -6
View File
@@ -312,21 +312,24 @@ pub async fn start_server(cfg: Arc<Config>, targets: Arc<ProcessTargets>) -> fut
router = router.merge(index_register_with_path(&web_dir_path, web_ui_path.as_str()));
}
}
router = router
let mut api_router = axum::Router::new()
.merge(xtream_api_register())
.merge(m3u_api_register())
.merge(xmltv_api_register())
.merge(hls_api_register());
let mut rate_limiting = false;
if let Some(rate_limiter) = app_state.config.reverse_proxy.as_ref().and_then(|r| r.rate_limit.clone()) {
rate_limiting = rate_limiter.enabled;
api_router = add_rate_limiter(api_router, rate_limiter);
}
router = router.merge(api_router);
if web_ui_enabled && web_ui_path.is_empty() {
router = router.merge(index_register_without_path(&web_dir_path));
}
let mut rate_limiting = false;
if let Some(rate_limiter) = app_state.config.reverse_proxy.as_ref().and_then(|r| r.rate_limit.clone()) {
rate_limiting = rate_limiter.enabled;
router = add_rate_limiter(router, rate_limiter);
}
// router = router.layer(axum::middleware::from_fn(log_routes));
let router: axum::Router<()> = router.with_state(shared_data.clone());
+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(),