Add lan streams and wan streams notification parameters

Closes #2276
This commit is contained in:
JonnyWong16 2024-03-24 16:09:41 -07:00
parent cfdb6975f0
commit 9fe58a6d86
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 6 additions and 0 deletions

View file

@ -381,6 +381,8 @@ NOTIFICATION_PARAMETERS = [
'category': 'Stream Details', 'category': 'Stream Details',
'parameters': [ 'parameters': [
{'name': 'Streams', 'type': 'int', 'value': 'streams', 'description': 'The total number of concurrent streams.'}, {'name': 'Streams', 'type': 'int', 'value': 'streams', 'description': 'The total number of concurrent streams.'},
{'name': 'LAN Streams', 'type': 'int', 'value': 'lan_streams', 'description': 'The total number of concurrent LAN streams.'},
{'name': 'WAN Streams', 'type': 'int', 'value': 'wan_streams', 'description': 'The total number of concurrent WAN streams.'},
{'name': 'Direct Plays', 'type': 'int', 'value': 'direct_plays', 'description': 'The total number of concurrent direct plays.'}, {'name': 'Direct Plays', 'type': 'int', 'value': 'direct_plays', 'description': 'The total number of concurrent direct plays.'},
{'name': 'Direct Streams', 'type': 'int', 'value': 'direct_streams', 'description': 'The total number of concurrent direct streams.'}, {'name': 'Direct Streams', 'type': 'int', 'value': 'direct_streams', 'description': 'The total number of concurrent direct streams.'},
{'name': 'Transcodes', 'type': 'int', 'value': 'transcodes', 'description': 'The total number of concurrent transcodes.'}, {'name': 'Transcodes', 'type': 'int', 'value': 'transcodes', 'description': 'The total number of concurrent transcodes.'},

View file

@ -624,6 +624,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
stream_count = len(sessions) stream_count = len(sessions)
user_stream_count = len(user_sessions) user_stream_count = len(user_sessions)
lan_streams = sum(1 for s in sessions if s['location'] == 'lan')
wan_streams = stream_count - lan_streams
lan_bandwidth = sum(helpers.cast_to_int(s['bandwidth']) for s in sessions if s['location'] == 'lan') lan_bandwidth = sum(helpers.cast_to_int(s['bandwidth']) for s in sessions if s['location'] == 'lan')
wan_bandwidth = sum(helpers.cast_to_int(s['bandwidth']) for s in sessions if s['location'] != 'lan') wan_bandwidth = sum(helpers.cast_to_int(s['bandwidth']) for s in sessions if s['location'] != 'lan')
@ -989,6 +991,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
'utctime': helpers.utc_now_iso(), 'utctime': helpers.utc_now_iso(),
# Stream parameters # Stream parameters
'streams': stream_count, 'streams': stream_count,
'lan_streams': lan_streams,
'wan_streams': wan_streams,
'direct_plays': transcode_decision_count['direct play'], 'direct_plays': transcode_decision_count['direct play'],
'direct_streams': transcode_decision_count['copy'], 'direct_streams': transcode_decision_count['copy'],
'transcodes': transcode_decision_count['transcode'], 'transcodes': transcode_decision_count['transcode'],