diff --git a/apps/proxy/ts_proxy/services/channel_service.py b/apps/proxy/ts_proxy/services/channel_service.py index 451af7d5..8b8a3d26 100644 --- a/apps/proxy/ts_proxy/services/channel_service.py +++ b/apps/proxy/ts_proxy/services/channel_service.py @@ -20,7 +20,7 @@ class ChannelService: """Service class for channel operations""" @staticmethod - def initialize_channel(channel_id, stream_url, user_agent, transcode=False, profile_value=None, stream_id=None): + def initialize_channel(channel_id, stream_url, user_agent, transcode=False, stream_profile_value=None, stream_id=None, m3u_profile_id=None): """ Initialize a channel with the given parameters. @@ -29,8 +29,9 @@ class ChannelService: stream_url: URL of the stream user_agent: User agent for the stream connection transcode: Whether to transcode the stream - profile_value: Stream profile value to store in metadata + stream_profile_value: Stream profile value to store in metadata stream_id: ID of the stream being used + m3u_profile_id: ID of the M3U profile being used Returns: bool: Success status @@ -67,10 +68,12 @@ class ChannelService: if success and proxy_server.redis_client: metadata_key = RedisKeys.channel_metadata(channel_id) update_data = {} - if profile_value: - update_data[ChannelMetadataField.STREAM_PROFILE] = profile_value + if stream_profile_value: + update_data[ChannelMetadataField.STREAM_PROFILE] = stream_profile_value if stream_id: update_data[ChannelMetadataField.STREAM_ID] = str(stream_id) + if m3u_profile_id: + update_data[ChannelMetadataField.M3U_PROFILE] = str(m3u_profile_id) if update_data: proxy_server.redis_client.hset(metadata_key, mapping=update_data) diff --git a/apps/proxy/ts_proxy/views.py b/apps/proxy/ts_proxy/views.py index 41074b6d..8455d490 100644 --- a/apps/proxy/ts_proxy/views.py +++ b/apps/proxy/ts_proxy/views.py @@ -91,8 +91,8 @@ def stream_ts(request, channel_id): return JsonResponse({'error': 'Channel not available'}, status=404) # Get the stream ID from the channel - stream_id, profile_id = channel.get_stream() - logger.info(f"Channel {channel_id} using stream ID {stream_id}, profile ID {profile_id}") + stream_id, m3u_profile_id = channel.get_stream() + logger.info(f"Channel {channel_id} using stream ID {stream_id}, m3u account profile ID {m3u_profile_id}") # Generate transcode command if needed stream_profile = channel.get_stream_profile() @@ -101,7 +101,7 @@ def stream_ts(request, channel_id): # Initialize channel with the stream's user agent (not the client's) success = ChannelService.initialize_channel( - channel_id, stream_url, stream_user_agent, transcode, profile_value, stream_id + channel_id, stream_url, stream_user_agent, transcode, profile_value, stream_id, m3u_profile_id ) if not success: