From 63f80ab17834ea9e268bf0068d617c628fe5f130 Mon Sep 17 00:00:00 2001 From: gitdeathbot Date: Tue, 9 Jun 2026 11:38:45 -0500 Subject: [PATCH 1/2] feat(ecm): add Pattern 0b/0c for space-separated YYYY MM DD datetime format Peacock Events channels use a space-separated datetime format in their names (e.g. "2026 05 17 11:45:00 AM" or "(2026 06 09 20:00:00)") that none of the existing date patterns in _extract_date_from_channel_name matched. This caused the [PastDate:0] hide rule to be blind to these channels, leaving stale past-dated event channels visible in the guide indefinitely (until the slower [UndatedAge:2] rule eventually caught them after 2 days). Add two new patterns: - Pattern 0b: space-separated datetime in parentheses e.g. Channel Name (2026 06 09 20:00:00) or (2026 06 09 08:00:00 AM) - Pattern 0c: space-separated datetime inline (no parentheses) e.g. Peacock Events 048: Event Name | 2026 04 29 06:01 AM EDT Uses first match so the event date is preferred over any trailing timestamp. --- plugins/event-channel-managarr/plugin.py | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/plugins/event-channel-managarr/plugin.py b/plugins/event-channel-managarr/plugin.py index 1ef6707..2f7090b 100644 --- a/plugins/event-channel-managarr/plugin.py +++ b/plugins/event-channel-managarr/plugin.py @@ -7,7 +7,7 @@ import logging import json -import csv +import csvh try: import fcntl except ImportError: @@ -1231,6 +1231,33 @@ def _apply_meridiem(hour, meridiem): except ValueError: pass + # Pattern 0b: (YYYY MM DD HH:MM:SS[ AM/PM]) — space-separated datetime in parentheses. + # Matches formats like: Channel Name (2026 06 09 20:00:00) or Channel Name (2026 06 09 08:00:00 AM) + pattern0b = re.search(r'\((\d{4})\s+(\d{2})\s+(\d{2})\s+(\d{1,2}):(\d{2}):(\d{2})\s*(?P[AaPp][Mm])?\)', channel_name) + if pattern0b: + year, month, day, hour, minute, second = map(int, pattern0b.groups()[:6]) + hour = _apply_meridiem(hour, pattern0b.group("ap")) + try: + extracted_date = datetime(year, month, day, hour, minute, second) + logger.debug(f"Extracted datetime {extracted_date} from pattern (YYYY MM DD HH:MM:SS[ AM/PM]) in '{channel_name}'") + return extracted_date + except ValueError: + pass + + # Pattern 0c: YYYY MM DD HH:MM:SS[ AM/PM] — space-separated datetime inline (no parentheses). + # Matches formats like: Peacock Events 048: Upcoming (France v. England | 2026 05 17 11:45:00 AM) | 2026 04 29 06:01 AM EDT + # Uses the first match so the event date (earlier in the name) is preferred over any trailing timestamp. + pattern0c = re.search(r'(?[AaPp][Mm])?(?!\d)', channel_name) + if pattern0c: + year, month, day, hour, minute, second = map(int, pattern0c.groups()[:6]) + hour = _apply_meridiem(hour, pattern0c.group("ap")) + try: + extracted_date = datetime(year, month, day, hour, minute, second) + logger.debug(f"Extracted datetime {extracted_date} from pattern YYYY MM DD HH:MM:SS[ AM/PM] in '{channel_name}'") + return extracted_date + except ValueError: + pass + # Pattern 1: M/D/YYYY or M/D/YY — interpreted per date_format setting. pattern1 = re.search(r'\b(\d{1,2})/(\d{1,2})/(\d{2,4})\b', channel_name) if pattern1: From ab3fea4cd96372845ea8186b1c940e8ac710f6b3 Mon Sep 17 00:00:00 2001 From: gitdeathbot Date: Tue, 9 Jun 2026 11:41:58 -0500 Subject: [PATCH 2/2] fix: revert accidental import csv -> csvh typo --- plugins/event-channel-managarr/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/event-channel-managarr/plugin.py b/plugins/event-channel-managarr/plugin.py index 2f7090b..2229dc4 100644 --- a/plugins/event-channel-managarr/plugin.py +++ b/plugins/event-channel-managarr/plugin.py @@ -7,7 +7,7 @@ import logging import json -import csvh +import csv try: import fcntl except ImportError: