fix zero params extensions

This commit is contained in:
Vladimir Mandic
2024-06-25 12:29:07 -04:00
parent 309860b883
commit 7c6c849bd6
3 changed files with 32 additions and 39 deletions
+27 -36
View File
@@ -489,10 +489,9 @@ class ScriptRunner:
s = ScriptSummary('before-process')
for script in self.alwayson_scripts:
try:
args = p.script_args[script.args_from:script.args_to]
if len(args) == 0:
continue
script.before_process(p, *args, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.before_process(p, *args, **kwargs)
except Exception as e:
errors.display(e, f"Error running before process: {script.filename}")
s.record(script.title())
@@ -502,10 +501,9 @@ class ScriptRunner:
s = ScriptSummary('process')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.process(p, *args, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.process(p, *args, **kwargs)
except Exception as e:
errors.display(e, f'Running script process: {script.filename}')
s.record(script.title())
@@ -516,10 +514,9 @@ class ScriptRunner:
processed = None
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
processed = script.process_images(p, *args, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
processed = script.process_images(p, *args, **kwargs)
except Exception as e:
errors.display(e, f'Running script process images: {script.filename}')
s.record(script.title())
@@ -530,10 +527,9 @@ class ScriptRunner:
s = ScriptSummary('before-process-batch')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.before_process_batch(p, *args, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.before_process_batch(p, *args, **kwargs)
except Exception as e:
errors.display(e, f'Running script before process batch: {script.filename}')
s.record(script.title())
@@ -543,10 +539,9 @@ class ScriptRunner:
s = ScriptSummary('process-batch')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.process_batch(p, *args, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.process_batch(p, *args, **kwargs)
except Exception as e:
errors.display(e, f'Running script process batch: {script.filename}')
s.record(script.title())
@@ -556,10 +551,9 @@ class ScriptRunner:
s = ScriptSummary('postprocess')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.postprocess(p, processed, *args)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.postprocess(p, processed, *args)
except Exception as e:
errors.display(e, f'Running script postprocess: {script.filename}')
s.record(script.title())
@@ -569,10 +563,9 @@ class ScriptRunner:
s = ScriptSummary('postprocess-batch')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.postprocess_batch(p, *args, images=images, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.postprocess_batch(p, *args, images=images, **kwargs)
except Exception as e:
errors.display(e, f'Running script before postprocess batch: {script.filename}')
s.record(script.title())
@@ -582,10 +575,9 @@ class ScriptRunner:
s = ScriptSummary('postprocess-batch-list')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.postprocess_batch_list(p, pp, *args, **kwargs)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.postprocess_batch_list(p, pp, *args, **kwargs)
except Exception as e:
errors.display(e, f'Running script before postprocess batch list: {script.filename}')
s.record(script.title())
@@ -595,10 +587,9 @@ class ScriptRunner:
s = ScriptSummary('postprocess-image')
for script in self.alwayson_scripts:
try:
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
if len(args) == 0:
continue
script.postprocess_image(p, pp, *args)
if (script.args_to > 0) and (script.args_to >= script.args_from):
args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to])
script.postprocess_image(p, pp, *args)
except Exception as e:
errors.display(e, f'Running script postprocess image: {script.filename}')
s.record(script.title())