Add delay to kill stream script

This commit is contained in:
Noam Okman 2024-05-03 09:05:46 +03:00
parent e097a07ca5
commit 4961e33a8e
2 changed files with 20 additions and 0 deletions

View File

@ -592,6 +592,8 @@ if __name__ == "__main__":
help='Poster URL of the media') help='Poster URL of the media')
parser.add_argument('--richColor', type=arg_decoding, parser.add_argument('--richColor', type=arg_decoding,
help='Color of the rich message') 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', parser.add_argument("--debug", action='store_true',
help='Enable debug messages.') help='Enable debug messages.')
@ -623,6 +625,9 @@ if __name__ == "__main__":
else: else:
kill_message = 'The server owner has ended the stream.' kill_message = 'The server owner has ended the stream.'
if opts.delay:
time.sleep(opts.delay)
if opts.jbop == 'stream': if opts.jbop == 'stream':
tautulli_stream.terminate(kill_message) tautulli_stream.terminate(kill_message)
notify(opts, kill_message, 'Stream', tautulli_stream, tautulli_server) notify(opts, kill_message, 'Stream', tautulli_stream, tautulli_server)

View File

@ -185,6 +185,21 @@ Arguments:
--jbop stream --username {username} --sessionId {session_id} --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 ### Kill all of a user's streams with notification
Triggers: Playback Start Triggers: Playback Start