Check author.Task() parameters
Check author.Task() parameters, and refuse tasks with empty name or type.
This commit is contained in:
parent
e03e111603
commit
6a7545f334
@ -21,6 +21,8 @@ package job_compilers
|
|||||||
* ***** END GPL LICENSE BLOCK ***** */
|
* ***** END GPL LICENSE BLOCK ***** */
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dop251/goja"
|
"github.com/dop251/goja"
|
||||||
@ -74,6 +76,15 @@ type AuthoredCommand struct {
|
|||||||
type AuthoredCommandParameters map[string]interface{}
|
type AuthoredCommandParameters map[string]interface{}
|
||||||
|
|
||||||
func (a *Author) Task(name string, taskType string) (*AuthoredTask, error) {
|
func (a *Author) Task(name string, taskType string) (*AuthoredTask, error) {
|
||||||
|
name = strings.TrimSpace(name)
|
||||||
|
taskType = strings.TrimSpace(taskType)
|
||||||
|
if name == "" {
|
||||||
|
return nil, errors.New("author.Task(name, type): name is required")
|
||||||
|
}
|
||||||
|
if taskType == "" {
|
||||||
|
return nil, errors.New("author.Task(name, type): type is required")
|
||||||
|
}
|
||||||
|
|
||||||
at := AuthoredTask{
|
at := AuthoredTask{
|
||||||
uuid.New().String(),
|
uuid.New().String(),
|
||||||
name,
|
name,
|
||||||
|
@ -120,7 +120,7 @@ function authorCreateVideoTask(settings, renderDir) {
|
|||||||
const stem = path.stem(settings.filepath).replace('.flamenco', '');
|
const stem = path.stem(settings.filepath).replace('.flamenco', '');
|
||||||
const outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`);
|
const outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`);
|
||||||
|
|
||||||
const task = author.Task('create-video');
|
const task = author.Task('create-video', 'ffmpeg');
|
||||||
const command = author.Command("create-video", {
|
const command = author.Command("create-video", {
|
||||||
input_files: path.join(renderDir, `*${settings.output_file_extension}`),
|
input_files: path.join(renderDir, `*${settings.output_file_extension}`),
|
||||||
output_file: outfile,
|
output_file: outfile,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user