You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
944 B
59 lines
944 B
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
var Pipelines []Pipeline
|
|
|
|
type PipelineType int
|
|
type PipelineStepType int
|
|
|
|
const (
|
|
Image PipelineType = iota
|
|
Video
|
|
)
|
|
|
|
const (
|
|
Resize PipelineStepType = iota
|
|
Compress
|
|
Encode
|
|
)
|
|
|
|
type Pipeline struct {
|
|
Name string
|
|
Type PipelineType
|
|
RemoveMetadata bool
|
|
Steps []Step
|
|
}
|
|
|
|
type Step struct {
|
|
Name string
|
|
Type PipelineStepType
|
|
}
|
|
|
|
func DeserializePipelines(pipelines [][]byte) []Pipeline {
|
|
values := make([]Pipeline, len(pipelines))
|
|
|
|
for index, pipeline := range pipelines {
|
|
var deserializedObject Pipeline
|
|
json.Unmarshal(pipeline, &deserializedObject)
|
|
values[index] = deserializedObject
|
|
}
|
|
|
|
return values
|
|
}
|
|
|
|
// func LoadPipelines() {
|
|
// var files []string
|
|
|
|
// err := filepath.Walk("./pipelines", func(path string, info fs.FileInfo, err error) error {
|
|
// data, err := os.ReadFile(path)
|
|
|
|
// return nil
|
|
// })
|
|
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// }
|