From 94931383d5155726e3a02b0058894155611695eb Mon Sep 17 00:00:00 2001 From: Nirvana Date: Thu, 11 Jun 2026 14:39:35 +0200 Subject: [PATCH] magenta2 catchup --- .../providers/magenta2/channel_manager.py | 6 ++++++ lib/streaming_providers/providers/magenta2/provider.py | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/streaming_providers/providers/magenta2/channel_manager.py b/lib/streaming_providers/providers/magenta2/channel_manager.py index 74ec471..983fcef 100644 --- a/lib/streaming_providers/providers/magenta2/channel_manager.py +++ b/lib/streaming_providers/providers/magenta2/channel_manager.py @@ -85,6 +85,7 @@ class ChannelManager: provider_config: Optional[ProviderConfig], auth_callback: Callable[[], str], build_scaled_image_url_callback: Callable[[str], Optional[str]], + catchup_window: int = 4, ): self._http = http_manager self._provider_name = provider_name @@ -96,6 +97,7 @@ class ChannelManager: self._provider_config = provider_config self._ensure_authenticated = auth_callback self._build_scaled_image_url = build_scaled_image_url_callback + self.catchup_window = catchup_window # Populated on first get_channels() call; returned directly on subsequent calls. self._cached_channels: Optional[List[StreamingChannel]] = None @@ -213,6 +215,8 @@ class ChannelManager: else tp_ch.channel_number ) + catchup_hours = getattr(tp_ch, 'catchup_hours', None) or self.catchup_window + magenta2_channel = Magenta2Channel( name=name, channel_id=tp_ch.release_pid, @@ -231,6 +235,8 @@ class ChannelManager: if tp_ch.hls_url: streaming_channel.hls_url = tp_ch.hls_url + streaming_channel.catchup_hours = catchup_hours + self._live_manifest_cache[tp_ch.release_pid] = tp_ch.mpd_url self._live_pid_cache[tp_ch.release_pid] = tp_ch.release_pid diff --git a/lib/streaming_providers/providers/magenta2/provider.py b/lib/streaming_providers/providers/magenta2/provider.py index 1fd97f3..b35c5cb 100644 --- a/lib/streaming_providers/providers/magenta2/provider.py +++ b/lib/streaming_providers/providers/magenta2/provider.py @@ -226,6 +226,7 @@ class Magenta2Provider(StreamingProvider): provider_config=self.provider_config, auth_callback=self._ensure_authenticated, build_scaled_image_url_callback=self._build_scaled_image_url, + catchup_window=self.catchup_window, ) logger.info("✓ ChannelManager initialized")