Change parameter format of blender-render
command
This commit is contained in:
parent
30518ca3af
commit
0b3311b0a7
@ -63,8 +63,9 @@ type AuthoredTask struct {
|
|||||||
|
|
||||||
type AuthoredCommand struct {
|
type AuthoredCommand struct {
|
||||||
Type string
|
Type string
|
||||||
Parameters map[string]string
|
Parameters AuthoredCommandParameters
|
||||||
}
|
}
|
||||||
|
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) {
|
||||||
at := AuthoredTask{
|
at := AuthoredTask{
|
||||||
@ -77,7 +78,7 @@ func (a *Author) Task(name string, taskType string) (*AuthoredTask, error) {
|
|||||||
return &at, nil
|
return &at, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Author) Command(cmdType string, parameters map[string]string) (*AuthoredCommand, error) {
|
func (a *Author) Command(cmdType string, parameters AuthoredCommandParameters) (*AuthoredCommand, error) {
|
||||||
ac := AuthoredCommand{cmdType, parameters}
|
ac := AuthoredCommand{cmdType, parameters}
|
||||||
return &ac, nil
|
return &ac, nil
|
||||||
}
|
}
|
||||||
|
@ -104,12 +104,17 @@ func TestSimpleBlenderRenderHappy(t *testing.T) {
|
|||||||
// Tasks should have been created to render the frames.
|
// Tasks should have been created to render the frames.
|
||||||
assert.Equal(t, 4, len(aj.Tasks))
|
assert.Equal(t, 4, len(aj.Tasks))
|
||||||
t0 := aj.Tasks[0]
|
t0 := aj.Tasks[0]
|
||||||
|
expectCliArgs := []interface{}{ // They are strings, but Goja doesn't know that and will produce an []interface{}.
|
||||||
|
"--render-output", "/render/sf__intermediate-2006-01-02_090405/frames",
|
||||||
|
"--render-format", settings["format"].(string),
|
||||||
|
"--render-frame", "1-3",
|
||||||
|
}
|
||||||
assert.Equal(t, "render-1-3", t0.Name)
|
assert.Equal(t, "render-1-3", t0.Name)
|
||||||
assert.Equal(t, 1, len(t0.Commands))
|
assert.Equal(t, 1, len(t0.Commands))
|
||||||
assert.Equal(t, "blender-render", t0.Commands[0].Type)
|
assert.Equal(t, "blender-render", t0.Commands[0].Type)
|
||||||
assert.Equal(t, "{blender}", t0.Commands[0].Parameters["cmd"])
|
assert.EqualValues(t, AuthoredCommandParameters{
|
||||||
assert.Equal(t, settings["filepath"], t0.Commands[0].Parameters["filepath"])
|
"exe": "{blender}",
|
||||||
assert.Equal(t, settings["format"], t0.Commands[0].Parameters["format"])
|
"blendfile": settings["filepath"].(string),
|
||||||
assert.Equal(t, "1-3", t0.Commands[0].Parameters["frames"])
|
"args": expectCliArgs,
|
||||||
assert.Equal(t, "/render/sf__intermediate-2006-01-02_090405/frames", t0.Commands[0].Parameters["render_output"])
|
}, t0.Commands[0].Parameters)
|
||||||
}
|
}
|
||||||
|
@ -91,11 +91,13 @@ function authorRenderTasks(settings, renderDir, renderOutput) {
|
|||||||
for (let chunk of chunks) {
|
for (let chunk of chunks) {
|
||||||
const task = author.Task(`render-${chunk}`, "blender");
|
const task = author.Task(`render-${chunk}`, "blender");
|
||||||
const command = author.Command("blender-render", {
|
const command = author.Command("blender-render", {
|
||||||
cmd: settings.blender_cmd,
|
exe: settings.blender_cmd,
|
||||||
filepath: settings.filepath,
|
blendfile: settings.filepath,
|
||||||
format: settings.format,
|
args: [
|
||||||
render_output: path.join(renderDir, path.basename(renderOutput)),
|
"--render-output", path.join(renderDir, path.basename(renderOutput)),
|
||||||
frames: chunk,
|
"--render-format", settings.format,
|
||||||
|
"--render-frame", chunk,
|
||||||
|
]
|
||||||
});
|
});
|
||||||
task.addCommand(command);
|
task.addCommand(command);
|
||||||
renderTasks.push(task);
|
renderTasks.push(task);
|
||||||
|
@ -78,7 +78,7 @@ func (db *DB) StoreJob(ctx context.Context, authoredJob job_compilers.AuthoredJo
|
|||||||
Name: authoredJob.Name,
|
Name: authoredJob.Name,
|
||||||
JobType: authoredJob.JobType,
|
JobType: authoredJob.JobType,
|
||||||
Priority: int8(authoredJob.Priority),
|
Priority: int8(authoredJob.Priority),
|
||||||
Settings: JobSettings(authoredJob.Settings),
|
Settings: StringInterfaceMap(authoredJob.Settings),
|
||||||
Metadata: StringStringMap(authoredJob.Metadata),
|
Metadata: StringStringMap(authoredJob.Metadata),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ func (db *DB) StoreJob(ctx context.Context, authoredJob job_compilers.AuthoredJo
|
|||||||
for _, authoredCommand := range authoredTask.Commands {
|
for _, authoredCommand := range authoredTask.Commands {
|
||||||
commands = append(commands, Command{
|
commands = append(commands, Command{
|
||||||
Type: authoredCommand.Type,
|
Type: authoredCommand.Type,
|
||||||
Parameters: authoredCommand.Parameters,
|
Parameters: StringInterfaceMap(authoredCommand.Parameters),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,12 +73,14 @@ func TestStoreAuthoredJob(t *testing.T) {
|
|||||||
Commands: []job_compilers.AuthoredCommand{
|
Commands: []job_compilers.AuthoredCommand{
|
||||||
{
|
{
|
||||||
Type: "blender-render",
|
Type: "blender-render",
|
||||||
Parameters: StringStringMap{
|
Parameters: job_compilers.AuthoredCommandParameters{
|
||||||
"cmd": "{blender}",
|
"exe": "{blender}",
|
||||||
"filepath": "/path/to/file.blend",
|
"blendfile": "/path/to/file.blend",
|
||||||
"format": "PNG",
|
"args": []interface{}{
|
||||||
"render_output": "/path/to/output/######.png",
|
"--render-output", "/path/to/output/######.png",
|
||||||
"frames": "1-3",
|
"--render-format", "PNG",
|
||||||
|
"--render-frame", "1-3",
|
||||||
|
},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -93,7 +95,7 @@ func TestStoreAuthoredJob(t *testing.T) {
|
|||||||
Commands: []job_compilers.AuthoredCommand{
|
Commands: []job_compilers.AuthoredCommand{
|
||||||
{
|
{
|
||||||
Type: "merge-frames-to-video",
|
Type: "merge-frames-to-video",
|
||||||
Parameters: StringStringMap{
|
Parameters: job_compilers.AuthoredCommandParameters{
|
||||||
"images": "/path/to/output/######.png",
|
"images": "/path/to/output/######.png",
|
||||||
"output": "/path/to/output/preview.mkv",
|
"output": "/path/to/output/preview.mkv",
|
||||||
"ffmpegParams": "-c:v hevc -crf 31",
|
"ffmpegParams": "-c:v hevc -crf 31",
|
||||||
|
@ -37,11 +37,11 @@ type Job struct {
|
|||||||
Priority int8 `gorm:"type:smallint;not null"`
|
Priority int8 `gorm:"type:smallint;not null"`
|
||||||
Status string `gorm:"type:varchar(32);not null"` // See JobStatusXxxx consts in openapi_types.gen.go
|
Status string `gorm:"type:varchar(32);not null"` // See JobStatusXxxx consts in openapi_types.gen.go
|
||||||
|
|
||||||
Settings JobSettings `gorm:"type:jsonb"`
|
Settings StringInterfaceMap `gorm:"type:jsonb"`
|
||||||
Metadata StringStringMap `gorm:"type:jsonb"`
|
Metadata StringStringMap `gorm:"type:jsonb"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobSettings map[string]interface{}
|
type StringInterfaceMap map[string]interface{}
|
||||||
type StringStringMap map[string]string
|
type StringStringMap map[string]string
|
||||||
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
@ -66,7 +66,7 @@ type Commands []Command
|
|||||||
|
|
||||||
type Command struct {
|
type Command struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Parameters StringStringMap `json:"parameters"`
|
Parameters StringInterfaceMap `json:"parameters"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Commands) Value() (driver.Value, error) {
|
func (c Commands) Value() (driver.Value, error) {
|
||||||
@ -80,10 +80,10 @@ func (c *Commands) Scan(value interface{}) error {
|
|||||||
return json.Unmarshal(b, &c)
|
return json.Unmarshal(b, &c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (js JobSettings) Value() (driver.Value, error) {
|
func (js StringInterfaceMap) Value() (driver.Value, error) {
|
||||||
return json.Marshal(js)
|
return json.Marshal(js)
|
||||||
}
|
}
|
||||||
func (js *JobSettings) Scan(value interface{}) error {
|
func (js *StringInterfaceMap) Scan(value interface{}) error {
|
||||||
b, ok := value.([]byte)
|
b, ok := value.([]byte)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("type assertion to []byte failed")
|
return errors.New("type assertion to []byte failed")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user