mirror of
https://github.com/euzu/tuliprox.git
synced 2026-09-30 21:12:12 +02:00
Adjustments to epg smart match
This commit is contained in:
@@ -65,18 +65,22 @@ impl EpgIdCache<'_> {
|
||||
/// assert!(cache.normalized.contains_key(&cache.normalize("Discovery Channel")));
|
||||
/// ```
|
||||
fn normalize_and_store(&mut self, name: &str, epg_id: Option<&String>) {
|
||||
let normalized_name = self.normalize(name);
|
||||
let phonetic = self.phonetic(&normalized_name);
|
||||
self.normalized.insert(normalized_name.to_string(), None, /*epg_id.map(std::string::ToString::to_string) */);
|
||||
self.phonetics.entry(phonetic.to_string()).or_default().insert(normalized_name);
|
||||
self.insert_normalized(name);
|
||||
|
||||
if let Some(chan_epg_id) = epg_id {
|
||||
let normalized_name = self.normalize(chan_epg_id);
|
||||
let phonetic = self.phonetic(&normalized_name);
|
||||
self.normalized.insert(normalized_name.to_string(), None, /*epg_id.map(std::string::ToString::to_string) */);
|
||||
self.phonetics.entry(phonetic.to_string()).or_default().insert(normalized_name);
|
||||
self.insert_normalized(chan_epg_id);
|
||||
}
|
||||
}
|
||||
fn insert_normalized(&mut self, key: &str) {
|
||||
let normalized = self.normalize(key);
|
||||
let phonetic = self.phonetic(&normalized);
|
||||
|
||||
self.normalized.insert(normalized.to_string(), None);
|
||||
self.phonetics
|
||||
.entry(phonetic.to_string())
|
||||
.or_default()
|
||||
.insert(normalized);
|
||||
}
|
||||
|
||||
/// Returns the normalized form of a channel name using the configured smart match settings.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user