From 2d8a0c76641fbeb818f6b0370febef9a4385eae9 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Thu, 18 Jun 2026 15:10:47 +0200 Subject: [PATCH] restructure epg --- .../providers/magentaeu/epg_manager.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/streaming_providers/providers/magentaeu/epg_manager.py b/lib/streaming_providers/providers/magentaeu/epg_manager.py index ba16aa6..07a468e 100644 --- a/lib/streaming_providers/providers/magentaeu/epg_manager.py +++ b/lib/streaming_providers/providers/magentaeu/epg_manager.py @@ -220,10 +220,13 @@ class MagentaEUEpgManager: ) -> List[EPGEntry]: date_from, date_to = self._resolve_window(start_time, end_time) - # Collect the calendar dates spanned by the window + # Collect the calendar dates spanned by the window, in Vienna local + # time — the bifrost API's `date` param is Vienna-local, so walking + # UTC calendar days here can pull in (or miss) an extra day. dates: List[datetime] = [] - current = date_from.replace(hour=0, minute=0, second=0, microsecond=0) - while current.date() <= date_to.date(): + current = date_from.astimezone(_VIENNA_TZ).replace(hour=0, minute=0, second=0, microsecond=0) + local_to = date_to.astimezone(_VIENNA_TZ) + while current.date() <= local_to.date(): dates.append(current) current = current + timedelta(days=1) @@ -267,10 +270,13 @@ class MagentaEUEpgManager: date_from, date_to = self._resolve_window(start_time, end_time) - # Collect the calendar dates spanned by the window + # Collect the calendar dates spanned by the window, in Vienna local + # time — the bifrost API's `date` param is Vienna-local, so walking + # UTC calendar days here can pull in (or miss) an extra day. dates: List[datetime] = [] - current = date_from.replace(hour=0, minute=0, second=0, microsecond=0) - while current.date() <= date_to.date(): + current = date_from.astimezone(_VIENNA_TZ).replace(hour=0, minute=0, second=0, microsecond=0) + local_to = date_to.astimezone(_VIENNA_TZ) + while current.date() <= local_to.date(): dates.append(current) current = current + timedelta(days=1)