Add plugin tasks (#651)

This commit is contained in:
WithoutPants
2020-08-08 12:05:35 +10:00
committed by GitHub
parent 0874852fa8
commit 0ffefa6e16
47 changed files with 2855 additions and 17 deletions

30
pkg/plugin/args.go Normal file
View File

@@ -0,0 +1,30 @@
package plugin
import (
"github.com/stashapp/stash/pkg/models"
)
func findArg(args []*models.PluginArgInput, name string) *models.PluginArgInput {
for _, v := range args {
if v.Key == name {
return v
}
}
return nil
}
func applyDefaultArgs(args []*models.PluginArgInput, defaultArgs map[string]string) []*models.PluginArgInput {
for k, v := range defaultArgs {
if arg := findArg(args, k); arg == nil {
args = append(args, &models.PluginArgInput{
Key: k,
Value: &models.PluginValueInput{
Str: &v,
},
})
}
}
return args
}