mapper refactoring

This commit is contained in:
euzu
2025-05-21 22:01:34 +02:00
parent 4bcba1fa94
commit f5ee28ddf6
9 changed files with 812 additions and 232 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
use crate::model::{ConfigInput, InputAffix, AFFIX_FIELDS, valid_property};
use crate::model::{ConfigInput, InputAffix, valid_property, MAPPER_FIELDS};
use crate::model::{FetchedPlaylist, FieldGetAccessor, FieldSetAccessor, PlaylistItem};
use crate::utils::{debug_if_enabled};
@@ -19,7 +19,7 @@ fn create_affix_processor(affix: &InputAffix, is_prefix: bool) -> AffixProcessor
fn validate_and_create_affix_processor(affix: Option<&InputAffix>, is_prefix: bool) -> Option<AffixProcessor> {
if let Some(affix_def) = affix {
if (valid_property!(&affix_def.field.as_str(), AFFIX_FIELDS) && !affix_def.value.is_empty()) {
if (valid_property!(&affix_def.field.as_str(), MAPPER_FIELDS) && !affix_def.value.is_empty()) {
return Some(create_affix_processor(affix_def, is_prefix));
}
}
+2 -2
View File
@@ -144,11 +144,11 @@ fn map_channel(mut channel: PlaylistItem, mapping: &Mapping) -> PlaylistItem {
match &m.t_filter {
Some(filter) => {
if filter.filter(&provider, &mut mock_processor) {
apply_pattern!(&m.t_pattern, &provider, &mut processor);
//apply_pattern!(&m.t_pattern, &provider, &mut processor);
}
}
_ => {
apply_pattern!(&m.t_pattern, &provider, &mut processor);
//apply_pattern!(&m.t_pattern, &provider, &mut processor);
}
}
}