From 1eebee571211bf54541bd0b293e638afdfa6b332 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Thu, 18 Jun 2026 15:33:24 +0200 Subject: [PATCH] restructure epg --- .../providers/magentaeu/epg_manager.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/streaming_providers/providers/magentaeu/epg_manager.py b/lib/streaming_providers/providers/magentaeu/epg_manager.py index 07a468e..07aa713 100644 --- a/lib/streaming_providers/providers/magentaeu/epg_manager.py +++ b/lib/streaming_providers/providers/magentaeu/epg_manager.py @@ -398,11 +398,16 @@ class MagentaEUEpgManager: if end_time: local_end = self._ensure_tz(end_time).astimezone(_VIENNA_TZ) if local_end.date() == local_date.date(): - end_hour = min(((local_end.hour // 3) + 1) * 3, 24) - logger.debug( - f"end_time UTC={end_time} → Vienna local={local_end}, " - f"hour_offset={end_hour}" - ) + # Calculate which 3-hour block the end time falls into + end_block = local_end.hour // 3 + # If end time is exactly at a block boundary (e.g., 3:00, 6:00), + # we don't need the block starting at that hour + if local_end.hour % 3 == 0: + # End time is at the start of a block → we don't need that block + end_hour = end_block * 3 + else: + # End time is inside a block → we need that block + end_hour = (end_block + 1) * 3 logger.debug( f"[MagentaEUEpgManager/{self._country}] "