From 157012c56a98f7314496be687e4b333e929f96ea Mon Sep 17 00:00:00 2001 From: Fazzani Date: Tue, 24 Dec 2024 10:15:25 +0100 Subject: [PATCH] Bump version v0.1.6 --- pliptv/pl_filters/clean_name_filter.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pliptv/pl_filters/clean_name_filter.py b/pliptv/pl_filters/clean_name_filter.py index 104d09c..b451447 100644 --- a/pliptv/pl_filters/clean_name_filter.py +++ b/pliptv/pl_filters/clean_name_filter.py @@ -6,6 +6,8 @@ from pliptv.pl_filters.filter_abc import FilterABC, LoggingFilterAbcMixin from pliptv.utils.log.decorators import func_logger +regex_white_spaces = re.compile(r"(\s)+") + class CleanNameFilter(FilterABC, metaclass=LoggingFilterAbcMixin): def __init__(self, config: PlaylistConfig): @@ -17,6 +19,9 @@ def apply(self, value: Stream) -> Stream: for reg in self.filter_config.regex: regex = re.compile(reg, re.I | re.DOTALL) value.meta.display_name = regex.sub("", value.meta.display_name).strip() + for replacement in self.filter_config.replacements: value.meta.display_name = value.meta.display_name.replace(replacement, "") + + value.meta.display_name = regex_white_spaces.sub(" ", value.meta.display_name) return value