mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-20 16:51:10 +00:00
Add m3u_profile (id) to redis when channel is initialized.
This commit is contained in:
parent
4e9a52c80e
commit
ce6e019e6a
2 changed files with 10 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue