xtream and m3u parsing with streaming

This commit is contained in:
euzu
2025-12-12 15:49:10 +01:00
parent ee0441877d
commit 2738f8b7f3
4 changed files with 19 additions and 20 deletions
+1
View File
@@ -76,6 +76,7 @@
- UserTable: Copy credentials to clipboard from user table
- UserTable: Kick user action from streams table
- UserTable: Auto-generated username/password for new proxy users
- Update process uses now streams for data processing.
# 3.1.7 (2025-10-10)
- Added Dark/Bright theme switch
-1
View File
@@ -138,7 +138,6 @@ impl Epg {
let inner = writer.get_mut();
inner.flush().await?;
inner.shutdown().await?;
Ok(())
}
+5 -10
View File
@@ -158,16 +158,11 @@ pub async fn get_input_text_content_as_stream(client: &reqwest::Client, input: &
if filepath.exists() {
match get_local_file_content_as_stream(&filepath).await {
Ok(content) => {
if persist_filepath.is_some() {
let tee_reader: DynReader = if let Some(path) = persist_filepath {
let tee = tee_dyn_reader(content, &path, Some(Arc::new(|size| {
debug_if_enabled!("Persisted {} bytes", human_readable_byte_size(size as u64));
}))).await;
Box::pin(tee)
} else {
content
};
Some(tee_reader)
if let Some(path) = persist_filepath {
let tee = tee_dyn_reader(content, &path, Some(Arc::new(|size| {
debug_if_enabled!("Persisted {} bytes", human_readable_byte_size(size as u64));
}))).await;
Some(Box::pin(tee))
} else {
Some(content)
}
+13 -9
View File
@@ -72,7 +72,7 @@ where
let s = n.to_string();
match s.parse::<T>() {
Ok(v) => Ok(Some(v)),
Err(_) => Ok(None), // Fehler ignorieren, None zurückgeben
Err(_) => Ok(None), // Ignore parse errors, return None
}
}
@@ -83,17 +83,21 @@ where
return Ok(None);
}
// find the number
let digits = s.chars()
.skip_while(|c| !c.is_ascii_digit())
.take_while(|c| c.is_ascii_digit())
.collect::<String>();
if digits.is_empty() {
// find the number, preserving optional sign
let trimmed = s.trim_start_matches(|c: char| !c.is_ascii_digit() && c != '-' && c != '+');
if trimmed.is_empty() {
return Ok(None);
}
match digits.parse::<T>() {
let number_str = trimmed.chars()
.take_while(|c| c.is_ascii_digit() || (*c == '-' || *c == '+') && trimmed.starts_with(|x: char| x == '-' || x == '+'))
.collect::<String>();
if number_str.is_empty() || number_str == "-" || number_str == "+" {
return Ok(None);
}
match number_str.parse::<T>() {
Ok(v) => Ok(Some(v)),
Err(_) => Ok(None),
}