mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Export performance optimization (#475)
* recreate metadata path if needed, before exporting data
This commit is contained in:
@@ -2,10 +2,13 @@ package paths
|
||||
|
||||
import (
|
||||
"github.com/stashapp/stash/pkg/manager/config"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type jsonPaths struct {
|
||||
Metadata string
|
||||
|
||||
MappingsFile string
|
||||
ScrapedFile string
|
||||
|
||||
@@ -18,6 +21,7 @@ type jsonPaths struct {
|
||||
|
||||
func newJSONPaths() *jsonPaths {
|
||||
jp := jsonPaths{}
|
||||
jp.Metadata = config.GetMetadataPath()
|
||||
jp.MappingsFile = filepath.Join(config.GetMetadataPath(), "mappings.json")
|
||||
jp.ScrapedFile = filepath.Join(config.GetMetadataPath(), "scraped.json")
|
||||
jp.Performers = filepath.Join(config.GetMetadataPath(), "performers")
|
||||
@@ -28,6 +32,21 @@ func newJSONPaths() *jsonPaths {
|
||||
return &jp
|
||||
}
|
||||
|
||||
func GetJSONPaths() *jsonPaths {
|
||||
jp := newJSONPaths()
|
||||
return jp
|
||||
}
|
||||
|
||||
func EnsureJSONDirs() {
|
||||
jsonPaths := GetJSONPaths()
|
||||
utils.EnsureDir(jsonPaths.Metadata)
|
||||
utils.EnsureDir(jsonPaths.Scenes)
|
||||
utils.EnsureDir(jsonPaths.Galleries)
|
||||
utils.EnsureDir(jsonPaths.Performers)
|
||||
utils.EnsureDir(jsonPaths.Studios)
|
||||
utils.EnsureDir(jsonPaths.Movies)
|
||||
}
|
||||
|
||||
func (jp *jsonPaths) PerformerJSONPath(checksum string) string {
|
||||
return filepath.Join(jp.Performers, checksum+".json")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user