mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Fix plugin go examples (#2396)
This commit is contained in:
@@ -29,8 +29,8 @@ type TagDestroyInput struct {
|
||||
|
||||
type FindScenesResultType struct {
|
||||
Count graphql.Int
|
||||
DurationSeconds graphql.Float
|
||||
FilesizeBytes graphql.Int
|
||||
DurationSeconds graphql.Float `graphql:"duration" json:"duration"`
|
||||
FilesizeBytes graphql.Float `graphql:"filesize" json:"filesize"`
|
||||
Scenes []Scene
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
@@ -54,14 +55,14 @@ func main() {
|
||||
|
||||
func Run(input common.PluginInput, output *common.PluginOutput) error {
|
||||
modeArg := input.Args.String("mode")
|
||||
|
||||
ctx := context.TODO()
|
||||
var err error
|
||||
if modeArg == "" || modeArg == "add" {
|
||||
client := util.NewClient(input.ServerConnection)
|
||||
err = exampleCommon.AddTag(client)
|
||||
err = exampleCommon.AddTag(ctx, client)
|
||||
} else if modeArg == "remove" {
|
||||
client := util.NewClient(input.ServerConnection)
|
||||
err = exampleCommon.RemoveTag(client)
|
||||
err = exampleCommon.RemoveTag(ctx, client)
|
||||
} else if modeArg == "long" {
|
||||
err = doLongTask()
|
||||
} else if modeArg == "indef" {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
exampleCommon "github.com/stashapp/stash/pkg/plugin/examples/common"
|
||||
@@ -37,14 +38,15 @@ func (a *api) Stop(input struct{}, output *bool) error {
|
||||
// acts accordingly.
|
||||
func (a *api) Run(input common.PluginInput, output *common.PluginOutput) error {
|
||||
modeArg := input.Args.String("mode")
|
||||
ctx := context.TODO()
|
||||
|
||||
var err error
|
||||
if modeArg == "" || modeArg == "add" {
|
||||
client := util.NewClient(input.ServerConnection)
|
||||
err = exampleCommon.AddTag(client)
|
||||
err = exampleCommon.AddTag(ctx, client)
|
||||
} else if modeArg == "remove" {
|
||||
client := util.NewClient(input.ServerConnection)
|
||||
err = exampleCommon.RemoveTag(client)
|
||||
err = exampleCommon.RemoveTag(ctx, client)
|
||||
} else if modeArg == "long" {
|
||||
err = a.doLongTask()
|
||||
} else if modeArg == "indef" {
|
||||
|
||||
Reference in New Issue
Block a user