From 457486924ef80b6d2931a2339ae6cc8a10d9be90 Mon Sep 17 00:00:00 2001 From: dirtycajunrice Date: Wed, 19 Dec 2018 21:15:45 -0600 Subject: [PATCH] added functionality for dropping multi IP users --- killstream/kill_stream.py | 12 +++++++++++- killstream/readme.md | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/killstream/kill_stream.py b/killstream/kill_stream.py index 69cc819..b2a24f5 100644 --- a/killstream/kill_stream.py +++ b/killstream/kill_stream.py @@ -75,7 +75,7 @@ BODY_TEXT = "Killed session ID '{id}'. Reason: {message}" BODY_TEXT_USER = "Killed {user}'s stream. Reason: {message}." -SELECTOR = ['stream', 'allStreams', 'paused'] +SELECTOR = ['stream', 'allStreams', 'multiIpStreams', 'paused'] RICH_TYPE = ['discord', 'slack'] @@ -620,6 +620,16 @@ if __name__ == "__main__": tautulli_server.terminate_session(session_id=a_stream.session_id, message=kill_message) notify(opts, kill_message, 'All Streams', a_stream, tautulli_server) + elif opts.jbop == 'multiIpStreams': + if not (opts.notify and opts.richMessage): + tautulli_stream.get_all_stream_info() + user_streams = get_all_streams(tautulli_server, opts.userId) + for a_stream in user_streams: + if a_stream.ip_address != tautulli_stream.ip_address: + tautulli_stream.terminate(kill_message) + notify(opts, kill_message, 'Multiple IP Streams', tautulli_stream, tautulli_server) + + elif opts.jbop == 'paused': killed_stream = tautulli_stream.terminate_long_pause(kill_message, opts.limit, opts.interval) if killed_stream: diff --git a/killstream/readme.md b/killstream/readme.md index 985759b..1ca5d65 100644 --- a/killstream/readme.md +++ b/killstream/readme.md @@ -62,6 +62,15 @@ Arguments: --jbop stream --username {username} --sessionId {session_id} --killMessage 'You are only allowed 3 streams.' ``` +### Limit User streams to one IP + +Triggers: Playback Start + +Arguments: +``` +--jbop multiIpStreams --userId {user_id} --username {username} --sessionId {session_id} --killMessage 'You are only allowed to stream from one location at a time.' +``` + ### IP Whitelist Triggers: Playback Start