mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Check for a valid script and script extension
This commit is contained in:
parent
c814f219a2
commit
e0e5ac9ecc
1 changed files with 9 additions and 6 deletions
|
@ -3080,21 +3080,24 @@ class SCRIPTS(Notifier):
|
||||||
logger.error("Tautulli Notifiers :: No script folder specified.")
|
logger.error("Tautulli Notifiers :: No script folder specified.")
|
||||||
return
|
return
|
||||||
|
|
||||||
script_args = helpers.split_args(kwargs.get('script_args', subject))
|
|
||||||
|
|
||||||
logger.debug("Tautulli Notifiers :: Trying to run notify script, action: %s, arguments: %s"
|
|
||||||
% (action, script_args))
|
|
||||||
|
|
||||||
script = kwargs.get('script', self.config.get('script', ''))
|
script = kwargs.get('script', self.config.get('script', ''))
|
||||||
|
script_args = helpers.split_args(kwargs.get('script_args', subject))
|
||||||
user_id = kwargs.get('parameters', {}).get('user_id')
|
user_id = kwargs.get('parameters', {}).get('user_id')
|
||||||
|
|
||||||
|
logger.debug("Tautulli Notifiers :: Trying to run notify script: %s, arguments: %s, action: %s"
|
||||||
|
% (script, script_args, action))
|
||||||
|
|
||||||
# Don't try to run the script if the action does not have one
|
# Don't try to run the script if the action does not have one
|
||||||
if action and not script:
|
if action and not script:
|
||||||
logger.debug("Tautulli Notifiers :: No script selected for action %s, exiting..." % action)
|
logger.debug("Tautulli Notifiers :: No script selected for action '%s', exiting..." % action)
|
||||||
return
|
return
|
||||||
elif not script:
|
elif not script:
|
||||||
logger.debug("Tautulli Notifiers :: No script selected, exiting...")
|
logger.debug("Tautulli Notifiers :: No script selected, exiting...")
|
||||||
return
|
return
|
||||||
|
# Check for a valid script file
|
||||||
|
elif not os.path.isfile(script) or not script.endswith(tuple(self.script_exts)):
|
||||||
|
logger.error("Tautulli Notifiers :: Invalid script file '%s' specified, exiting..." % script)
|
||||||
|
return
|
||||||
|
|
||||||
name, ext = os.path.splitext(script)
|
name, ext = os.path.splitext(script)
|
||||||
prefix = self.script_exts.get(ext, '')
|
prefix = self.script_exts.get(ext, '')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue