added functionality for dropping multi IP users

This commit is contained in:
dirtycajunrice 2018-12-19 21:15:45 -06:00
parent f9ce8eae63
commit 457486924e
2 changed files with 20 additions and 1 deletions

View File

@ -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:

View File

@ -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