Skip to content

Commit

Permalink
Add lan streams and wan streams notification parameters
Browse files Browse the repository at this point in the history
Closes #2276
  • Loading branch information
JonnyWong16 committed Mar 24, 2024
1 parent cfdb697 commit 9fe58a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plexpy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@
'category': 'Stream Details',
'parameters': [
{'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 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.'},
Expand Down
4 changes: 4 additions & 0 deletions plexpy/notification_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m

stream_count = len(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')
wan_bandwidth = sum(helpers.cast_to_int(s['bandwidth']) for s in sessions if s['location'] != 'lan')
Expand Down Expand Up @@ -989,6 +991,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
'utctime': helpers.utc_now_iso(),
# Stream parameters
'streams': stream_count,
'lan_streams': lan_streams,
'wan_streams': wan_streams,
'direct_plays': transcode_decision_count['direct play'],
'direct_streams': transcode_decision_count['copy'],
'transcodes': transcode_decision_count['transcode'],
Expand Down

0 comments on commit 9fe58a6

Please sign in to comment.