- Fixed Sort

- Added cluster to favourites
- Added Regex cache to avoid multiple compilations of same regex
This commit is contained in:
euzu
2026-01-13 16:37:27 +01:00
parent 22d6524831
commit 873235d8f3
52 changed files with 1287 additions and 288 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ use regex::Regex;
use std::collections::HashSet;
use std::string::ToString;
use std::sync::atomic::AtomicBool;
use std::sync::LazyLock;
use std::sync::{Arc, LazyLock};
pub const USER_FILE: &str = "user.txt";
@@ -83,7 +83,7 @@ pub struct Constants {
pub re_base_href_wasm: Regex,
pub re_env_var: Regex,
pub re_memory_usage: Regex,
pub re_epg_normalize: Regex,
pub re_epg_normalize: Arc<Regex>,
pub re_template_var: Regex,
pub re_template_tag: Regex,
pub re_template_attribute: Regex,
@@ -119,7 +119,7 @@ pub static CONSTANTS: LazyLock<Constants> = LazyLock::new(||
re_base_href_wasm: Regex::new("'(/frontend\\-)").unwrap(),
re_env_var: Regex::new(r"\$\{env:(?P<var>[a-zA-Z_][a-zA-Z0-9_]*)}").unwrap(),
re_memory_usage: Regex::new(r"VmRSS:\s+(\d+) kB").unwrap(),
re_epg_normalize: Regex::new(r"[^a-zA-Z0-9\-]").unwrap(),
re_epg_normalize: Arc::new(Regex::new(r"[^a-zA-Z0-9\-]").unwrap()),
re_template_var: Regex::new("!(.*?)!").unwrap(),
re_template_tag: Regex::new("<tag:(.*?)>").unwrap(),
re_template_attribute: Regex::new("<(.*?)>").unwrap(),
+25
View File
@@ -398,3 +398,28 @@ where
{
serializer.serialize_str(&value.to_string())
}
/// Serde support for `XtreamCluster` fields.
/// Serializes as string (e.g., "live", "video", "series") and deserializes via `FromStr`.
pub mod xtream_cluster_serde {
use std::str::FromStr;
use serde::{Deserialize, Deserializer, Serializer};
use serde::de::Error;
use crate::model::XtreamCluster;
pub fn serialize<S>(value: &XtreamCluster, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(value.as_str())
}
pub fn deserialize<'de, D>(deserializer: D) -> Result<XtreamCluster, D::Error>
where
D: Deserializer<'de>,
{
let raw = String::deserialize(deserializer)?;
XtreamCluster::from_str(&raw).map_err(D::Error::custom)
}
}