From 9fe58a6d86cfc8ca39f77c52d3daae032bc97cdd Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 24 Mar 2024 16:09:41 -0700 Subject: [PATCH] Add lan streams and wan streams notification parameters Closes #2276 --- plexpy/common.py | 2 ++ plexpy/notification_handler.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/plexpy/common.py b/plexpy/common.py index 7ef798f8..a9156eb0 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -381,6 +381,8 @@ NOTIFICATION_PARAMETERS = [ '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.'}, diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 3ccec4e0..dd45e761 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -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') @@ -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'],