mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
reverted value checking for consistency, added in user id to client info
This commit is contained in:
parent
f69a462253
commit
1dd368278c
4 changed files with 59 additions and 39 deletions
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 5.2.4 on 2025-10-21 19:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0003_alter_user_custom_properties'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='stream_priority',
|
||||
field=models.IntegerField(default=0, help_text='Priority level for streaming tasks. Lower values indicate higher priority.'),
|
||||
),
|
||||
]
|
||||
|
|
@ -265,22 +265,64 @@ class ChannelStatus:
|
|||
}
|
||||
|
||||
# Add FFmpeg stream information
|
||||
info['video_codec'] = metadata.get(ChannelMetadataField.VIDEO_CODEC)
|
||||
info['resolution'] = metadata.get(ChannelMetadataField.RESOLUTION)
|
||||
info['source_fps'] = metadata.get(ChannelMetadataField.SOURCE_FPS)
|
||||
info['pixel_format'] = metadata.get(ChannelMetadataField.PIXEL_FORMAT)
|
||||
info['source_bitrate'] = metadata.get(ChannelMetadataField.SOURCE_BITRATE)
|
||||
info['audio_codec'] = metadata.get(ChannelMetadataField.AUDIO_CODEC)
|
||||
info['sample_rate'] = metadata.get(ChannelMetadataField.SAMPLE_RATE)
|
||||
info['audio_channels'] = metadata.get(ChannelMetadataField.AUDIO_CHANNELS)
|
||||
info['audio_bitrate'] = metadata.get(ChannelMetadataField.AUDIO_BITRATE)
|
||||
video_codec = metadata.get(ChannelMetadataField.VIDEO_CODEC)
|
||||
if video_codec:
|
||||
info['video_codec'] = video_codec
|
||||
|
||||
resolution = metadata.get(ChannelMetadataField.RESOLUTION)
|
||||
if resolution:
|
||||
info['resolution'] = resolution
|
||||
|
||||
source_fps = metadata.get(ChannelMetadataField.SOURCE_FPS)
|
||||
if source_fps:
|
||||
info['source_fps'] = source_fps
|
||||
|
||||
pixel_format = metadata.get(ChannelMetadataField.PIXEL_FORMAT)
|
||||
if pixel_format:
|
||||
info['pixel_format'] = pixel_format
|
||||
|
||||
source_bitrate = metadata.get(ChannelMetadataField.SOURCE_BITRATE)
|
||||
if source_bitrate:
|
||||
info['source_bitrate'] = source_bitrate
|
||||
|
||||
audio_codec = metadata.get(ChannelMetadataField.AUDIO_CODEC)
|
||||
if audio_codec:
|
||||
info['audio_codec'] = audio_codec
|
||||
|
||||
sample_rate = metadata.get(ChannelMetadataField.SAMPLE_RATE)
|
||||
if sample_rate:
|
||||
info['sample_rate'] = sample_rate
|
||||
|
||||
audio_channels = metadata.get(ChannelMetadataField.AUDIO_CHANNELS)
|
||||
if audio_channels:
|
||||
info['audio_channels'] = audio_channels
|
||||
|
||||
audio_bitrate = metadata.get(ChannelMetadataField.AUDIO_BITRATE)
|
||||
if audio_bitrate:
|
||||
info['audio_bitrate'] = audio_bitrate
|
||||
|
||||
|
||||
# Add FFmpeg performance stats
|
||||
info['ffmpeg_speed'] = metadata.get(ChannelMetadataField.FFMPEG_SPEED)
|
||||
info['ffmpeg_fps'] = metadata.get(ChannelMetadataField.FFMPEG_FPS)
|
||||
info['actual_fps'] = metadata.get(ChannelMetadataField.ACTUAL_FPS)
|
||||
info['ffmpeg_bitrate'] = metadata.get(ChannelMetadataField.FFMPEG_BITRATE)
|
||||
info['stream_type'] = metadata.get(ChannelMetadataField.STREAM_TYPE)
|
||||
ffmpeg_speed = metadata.get(ChannelMetadataField.FFMPEG_SPEED)
|
||||
if ffmpeg_speed:
|
||||
info['ffmpeg_speed'] = ffmpeg_speed
|
||||
|
||||
ffmpeg_fps = metadata.get(ChannelMetadataField.FFMPEG_FPS)
|
||||
if ffmpeg_fps:
|
||||
info['ffmpeg_fps'] = ffmpeg_fps
|
||||
|
||||
actual_fps = metadata.get(ChannelMetadataField.ACTUAL_FPS)
|
||||
if actual_fps:
|
||||
info['actual_fps'] = actual_fps
|
||||
|
||||
ffmpeg_bitrate = metadata.get(ChannelMetadataField.FFMPEG_BITRATE)
|
||||
if ffmpeg_bitrate:
|
||||
info['ffmpeg_bitrate'] = ffmpeg_bitrate
|
||||
|
||||
stream_type = metadata.get(ChannelMetadataField.STREAM_TYPE)
|
||||
if stream_type:
|
||||
info['stream_type'] = stream_type
|
||||
|
||||
|
||||
return info
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,8 @@ class ClientManager:
|
|||
"connected_at": current_time,
|
||||
"last_active": current_time,
|
||||
"worker_id": self.worker_id or "unknown",
|
||||
"user_level": user.user_level if user is not None else 100, # default to a high value since no user means the non-user specific M3U/HDHR
|
||||
"user_id": str(user.id) if user is not None else "unknown",
|
||||
# "user_level": user.user_level if user is not None else 100, # default to a high value since no user means the non-user specific M3U/HDHR
|
||||
}
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -459,10 +459,6 @@ class ProxyServer:
|
|||
lock_key = RedisKeys.channel_owner(channel_id)
|
||||
current = self.redis_client.get(lock_key)
|
||||
|
||||
<<<<<<< HEAD
|
||||
# Only extend if we're still the owner
|
||||
if current and current == self.worker_id:
|
||||
=======
|
||||
if current is None:
|
||||
# Key expired — re-acquire if we have the stream_manager
|
||||
if channel_id in self.stream_managers:
|
||||
|
|
@ -476,8 +472,7 @@ class ProxyServer:
|
|||
return False
|
||||
return False
|
||||
|
||||
if current.decode('utf-8') == self.worker_id:
|
||||
>>>>>>> origin/dev
|
||||
if current == self.worker_id:
|
||||
self.redis_client.expire(lock_key, ttl)
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue