stash/internal/manager/config/stash_config.go
WithoutPants 09c724b8d5
Add move files external interface (#3557)
* Add moveFiles graphql mutation
* Move library resolution code into config
* Implement file moving
* Log if old file not removed in SafeMove
* Ensure extensions are consistent
* Don't allow overwriting existing files
2023-03-22 07:57:26 +11:00

40 lines
806 B
Go

package config
import (
"path/filepath"
"github.com/stashapp/stash/pkg/fsutil"
)
// Stash configuration details
type StashConfigInput struct {
Path string `json:"path"`
ExcludeVideo bool `json:"excludeVideo"`
ExcludeImage bool `json:"excludeImage"`
}
type StashConfig struct {
Path string `json:"path"`
ExcludeVideo bool `json:"excludeVideo"`
ExcludeImage bool `json:"excludeImage"`
}
type StashConfigs []*StashConfig
func (s StashConfigs) GetStashFromPath(path string) *StashConfig {
for _, f := range s {
if fsutil.IsPathInDir(f.Path, filepath.Dir(path)) {
return f
}
}
return nil
}
func (s StashConfigs) GetStashFromDirPath(dirPath string) *StashConfig {
for _, f := range s {
if fsutil.IsPathInDir(f.Path, dirPath) {
return f
}
}
return nil
}