From 56aa5c77d27ed8715041b66f4d1103549df0ec16 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Mon, 15 Sep 2025 20:02:40 -0500 Subject: [PATCH] Filter out profiles during db query that are inactive. --- apps/proxy/ts_proxy/url_utils.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/apps/proxy/ts_proxy/url_utils.py b/apps/proxy/ts_proxy/url_utils.py index f7825971..75e7653e 100644 --- a/apps/proxy/ts_proxy/url_utils.py +++ b/apps/proxy/ts_proxy/url_utils.py @@ -142,7 +142,7 @@ def get_stream_info_for_switch(channel_id: str, target_stream_id: Optional[int] if not m3u_account: return {'error': 'Stream has no M3U account'} - m3u_profiles = m3u_account.profiles.all() + m3u_profiles = m3u_account.profiles.filter(is_active=True) default_profile = next((obj for obj in m3u_profiles if obj.is_default), None) if not default_profile: @@ -153,10 +153,6 @@ def get_stream_info_for_switch(channel_id: str, target_stream_id: Optional[int] selected_profile = None for profile in profiles: - # Skip inactive profiles - if not profile.is_active: - logger.debug(f"Skipping inactive profile {profile.id}") - continue # Check connection availability if redis_client: @@ -284,7 +280,7 @@ def get_alternate_streams(channel_id: str, current_stream_id: Optional[int] = No if m3u_account.is_active == False: logger.debug(f"M3U account {m3u_account.id} is inactive, skipping.") continue - m3u_profiles = m3u_account.profiles.all() + m3u_profiles = m3u_account.profiles.filter(is_active=True) default_profile = next((obj for obj in m3u_profiles if obj.is_default), None) if not default_profile: @@ -296,11 +292,6 @@ def get_alternate_streams(channel_id: str, current_stream_id: Optional[int] = No selected_profile = None for profile in profiles: - # Skip inactive profiles - if not profile.is_active: - logger.debug(f"Skipping inactive profile {profile.id}") - continue - # Check connection availability if redis_client: profile_connections_key = f"profile_connections:{profile.id}"