restructure epg

This commit is contained in:
Nirvana
2026-06-18 15:33:24 +02:00
parent 2d8a0c7664
commit 1eebee5712
@@ -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}] "