mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
* 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
40 lines
806 B
Go
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
|
|
}
|