2020-10-24 03:31:39 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/stashapp/stash/pkg/manager/config"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
|
|
"github.com/stashapp/stash/pkg/scraper/stashbox"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (r *mutationResolver) SubmitStashBoxFingerprints(ctx context.Context, input models.StashBoxFingerprintSubmissionInput) (bool, error) {
|
|
|
|
boxes := config.GetStashBoxes()
|
|
|
|
|
|
|
|
if input.StashBoxIndex < 0 || input.StashBoxIndex >= len(boxes) {
|
|
|
|
return false, fmt.Errorf("invalid stash_box_index %d", input.StashBoxIndex)
|
|
|
|
}
|
|
|
|
|
2021-01-18 01:23:20 +00:00
|
|
|
client := stashbox.NewClient(*boxes[input.StashBoxIndex], r.txnManager)
|
2020-10-24 03:31:39 +00:00
|
|
|
|
|
|
|
return client.SubmitStashBoxFingerprints(input.SceneIds, boxes[input.StashBoxIndex].Endpoint)
|
|
|
|
}
|