Browse Source

Only really run pre-script when it is set

tags/3.0.0RC2
Safihre 5 years ago
parent
commit
665c516db6
  1. 16
      sabnzbd/filesystem.py
  2. 5
      sabnzbd/nzbstuff.py

16
sabnzbd/filesystem.py

@ -457,17 +457,17 @@ def fix_unix_encoding(folder):
def make_script_path(script):
""" Return full script path, if any valid script exists, else None """
s_path = None
path = sabnzbd.cfg.script_dir.get_path()
if path and script:
script_path = None
script_dir = sabnzbd.cfg.script_dir.get_path()
if script_dir and script:
if script.lower() not in ("none", "default"):
s_path = os.path.join(path, script)
if not os.path.exists(s_path):
s_path = None
script_path = os.path.join(script_dir, script)
if not os.path.exists(script_path):
script_path = None
else:
# Paths to scripts should not be long-path notation
s_path = clip_path(s_path)
return s_path
script_path = clip_path(script_path)
return script_path
def get_admin_path(name, future):

5
sabnzbd/nzbstuff.py

@ -78,6 +78,7 @@ from sabnzbd.filesystem import (
remove_file,
get_filepath,
globber,
make_script_path,
)
from sabnzbd.decorators import synchronized
import sabnzbd.config as config
@ -789,8 +790,8 @@ class NzbObject(TryList):
self.set_priority(priority)
self.repair, self.unpack, self.delete = pp_to_opts(pp_tmp)
# Run user pre-queue script if needed
if not reuse and cfg.pre_script():
# Run user pre-queue script if set and valid
if not reuse and make_script_path(cfg.pre_script()):
# Call the script
accept, name, pp, cat_pp, script_pp, priority, group = sabnzbd.newsunpack.pre_queue(self, pp, cat)

Loading…
Cancel
Save