From f10f1700c12925d8019bf401cc894b1b1640135d Mon Sep 17 00:00:00 2001 From: Nirvana Date: Wed, 17 Jun 2026 17:53:14 +0200 Subject: [PATCH] restructure epg --- lib/streaming_providers/base/models/epg_models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/streaming_providers/base/models/epg_models.py b/lib/streaming_providers/base/models/epg_models.py index 49fabd9..afd79b4 100644 --- a/lib/streaming_providers/base/models/epg_models.py +++ b/lib/streaming_providers/base/models/epg_models.py @@ -566,6 +566,20 @@ class EPGEntry: def __post_init__(self): """Validate required fields after initialization.""" + # --- COERCE TIMESTAMPS FIRST --- + start_coerced = _coerce_timestamp(self.start, "start") + end_coerced = _coerce_timestamp(self.end, "end") + + if start_coerced is None: + raise ValueError("start is required and cannot be None") + if end_coerced is None: + raise ValueError("end is required and cannot be None") + + self.start = start_coerced + self.end = end_coerced + # --- END COERCION --- + + # Now validate if self.broadcast_id <= EPG_TAG_INVALID_UID: raise ValueError( f"broadcast_id must be greater than EPG_TAG_INVALID_UID ({EPG_TAG_INVALID_UID})"