Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay to kill stream script #423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions killstream/kill_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ def send_slack(self, title, color, poster_url, plex_url, message, footer):
help='Poster URL of the media')
parser.add_argument('--richColor', type=arg_decoding,
help='Color of the rich message')
parser.add_argument('--delay', type=int, default=0,
help='Delay in seconds before killing the stream.')
parser.add_argument("--debug", action='store_true',
help='Enable debug messages.')

Expand Down Expand Up @@ -623,6 +625,9 @@ def send_slack(self, title, color, poster_url, plex_url, message, footer):
else:
kill_message = 'The server owner has ended the stream.'

if opts.delay:
time.sleep(opts.delay)

if opts.jbop == 'stream':
tautulli_stream.terminate(kill_message)
notify(opts, kill_message, 'Stream', tautulli_stream, tautulli_server)
Expand Down
15 changes: 15 additions & 0 deletions killstream/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,21 @@ Arguments:
--jbop stream --username {username} --sessionId {session_id}
```

### Kill transcodes with a delay

_This will wait 10 seconds before killing the stream._

Triggers:
* Playback Start
* Transcode Decision Change

Conditions: \[ `Transcode Decision` | `is` | `transcode` \]

Arguments:
```
--jbop stream --username {username} --sessionId {session_id} --killMessage 'Transcoding streams are not allowed.' --delay 10
```

### Kill all of a user's streams with notification

Triggers: Playback Start
Expand Down