Export performance optimization (#475)

* recreate metadata path if needed, before exporting data
This commit is contained in:
bnkai
2020-04-24 05:52:21 +03:00
committed by GitHub
parent ba09bfa64a
commit 9b1518beae
147 changed files with 11923 additions and 9958 deletions

View File

@@ -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")
}