mirror of https://github.com/stashapp/stash.git
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package paths
|
|
|
|
import (
|
|
"github.com/stashapp/stash/internal/utils"
|
|
"path/filepath"
|
|
)
|
|
|
|
type jsonPaths struct {
|
|
MappingsFile string
|
|
ScrapedFile string
|
|
|
|
Performers string
|
|
Scenes string
|
|
Galleries string
|
|
Studios string
|
|
}
|
|
|
|
func newJSONPaths(p Paths) *jsonPaths {
|
|
jp := jsonPaths{}
|
|
jp.MappingsFile = filepath.Join(p.Config.Metadata, "mappings.json")
|
|
jp.ScrapedFile = filepath.Join(p.Config.Metadata, "scraped.json")
|
|
jp.Performers = filepath.Join(p.Config.Metadata, "performers")
|
|
jp.Scenes = filepath.Join(p.Config.Metadata, "scenes")
|
|
jp.Galleries = filepath.Join(p.Config.Metadata, "galleries")
|
|
jp.Studios = filepath.Join(p.Config.Metadata, "studios")
|
|
|
|
_ = utils.EnsureDir(jp.Performers)
|
|
_ = utils.EnsureDir(jp.Scenes)
|
|
_ = utils.EnsureDir(jp.Galleries)
|
|
_ = utils.EnsureDir(jp.Studios)
|
|
return &jp
|
|
}
|
|
|
|
func (jp *jsonPaths) PerformerJSONPath(checksum string) string {
|
|
return filepath.Join(jp.Performers, checksum + ".json")
|
|
}
|
|
|
|
func (jp *jsonPaths) SceneJSONPath(checksum string) string {
|
|
return filepath.Join(jp.Scenes, checksum + ".json")
|
|
}
|
|
|
|
func (jp *jsonPaths) StudioJSONPath(checksum string) string {
|
|
return filepath.Join(jp.Studios, checksum + ".json")
|
|
}
|