Closed SlothCroissant closed 5 years ago
Gotcha. Relevant area it the code.
# notify(opts, kill_message, 'All Streams', a_stream, tautulli_server)
def notify(all_opts, message, kill_type=None, stream=None, tautulli=None):
"""Decides which notifier type to use"""
if all_opts.notify and all_opts.richMessage:
rich_notify(all_opts.notify, all_opts.richMessage, all_opts.richColor, kill_type,
all_opts.serverName, all_opts.plexUrl, all_opts.posterUrl, message, stream, tautulli)
elif all_opts.notify:
basic_notify(all_opts.notify, all_opts.sessionId, all_opts.username, message, stream, tautulli)
I've commented out what's getting passed to the notify function. Notify function could have an additional if to check allStreams
and adjust the basic_notify
or rich_notify
accordingly.
Can you add the --sessionId {session_id}
argument to your agent and test again?
Worked like a charm! Thanks!
So adding that argument allowed for each session_id to be displayed? What worked?
Sorry, it half worked -
Adding the session ID variable to the arguments as you noted did in fact mean that a session ID showed in the notification for each killed stream. However, it passed the same session ID in the notification for both streams it killed, instead of the two unique session IDs that were killed.
Hope that makes sense!
It does make sense as that's what should happen. Your first observation is also what should happen. It just wasn't what you maybe expected.
The base message can be found in the script and you can change it how ever you like.
BODY_TEXT = "Killed session ID '{id}'. Reason: {message}"
If you want to customize the message that is sent out that will be up to you. If you feel like your edit to the script would be popular for others, please share it via PR. As I see it, there isn't anything to fix.
When testing kill_stream.py using the following command, the notification passed to Tautulli (it's a Pushover notification agent) has the body "Killed session ID 'None'. Reason: Killing all this users' streams".
python /config/scripts/killstream.py --jbop allStreams --userId 144976 --notify 7 --killMessage 'Killing all this users' streams'
The streams themselves are killed, but the session_id is "None" for every single one when the notification goes out.
Pulled the latest script today, running Tautulli VERSION V2.1.32 (though I'm running manually from Python in my test above).
Thoughts?
For more data, here's a quick debug output when run from Tautulli as well (acting in this case as a "if you have multiple streams, kill them all" scenario) The net result is exactly the same - session_id is set to "None" in the notification: