From b04447e100de7ffa1b8fae0c5e08334acfd4fe20 Mon Sep 17 00:00:00 2001 From: David Pooley Date: Sat, 8 Jul 2023 18:45:15 +0100 Subject: [PATCH] Update plexpy/notification_handler.py Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> --- plexpy/notification_handler.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index a9f3725e..8b4b8583 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -188,13 +188,13 @@ def notify_conditions(notify_action=None, stream_data=None, timeline_data=None, user_sessions = [s for s in result['sessions'] if s['user_id'] == stream_data['user_id']] if plexpy.CONFIG.NOTIFY_CONCURRENT_BY_IP: - ip_addresses = [] + ip_addresses = set() for s in user_sessions: if helpers.ip_type(s['ip_address']) == 'IPv6': - ip_addresses.append(helpers.get_ipv6_network_address(s['ip_address'])) - if helpers.ip_type(s['ip_address']) == 'IPv4': - ip_addresses.append(s['ip_address']) - evaluated = len(Counter(ip_addresses)) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD + ip_addresses.add(helpers.get_ipv6_network_address(s['ip_address'])) + elif helpers.ip_type(s['ip_address']) == 'IPv4': + ip_addresses.add(s['ip_address']) + evaluated = len(ip_addresses) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD else: evaluated = len(user_sessions) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD