diff --git a/graphql/documents/data/config.graphql b/graphql/documents/data/config.graphql index f9151fff9..80f8f4caa 100644 --- a/graphql/documents/data/config.graphql +++ b/graphql/documents/data/config.graphql @@ -6,6 +6,7 @@ fragment ConfigGeneralData on ConfigGeneralResult { } databasePath generatedPath + metadataPath cachePath calculateMD5 videoFileNamingAlgorithm diff --git a/graphql/schema/types/config.graphql b/graphql/schema/types/config.graphql index 25c80a79c..6c5f10f59 100644 --- a/graphql/schema/types/config.graphql +++ b/graphql/schema/types/config.graphql @@ -39,6 +39,8 @@ input ConfigGeneralInput { databasePath: String """Path to generated files""" generatedPath: String + """Path to import/export files""" + metadataPath: String """Path to cache""" cachePath: String """Whether to calculate MD5 checksums for scene video files""" @@ -110,6 +112,8 @@ type ConfigGeneralResult { databasePath: String! """Path to generated files""" generatedPath: String! + """Path to import/export files""" + metadataPath: String! """Path to the config file used""" configFilePath: String! """Path to scrapers""" diff --git a/pkg/api/resolver_mutation_configure.go b/pkg/api/resolver_mutation_configure.go index 5ebfb20f7..659787916 100644 --- a/pkg/api/resolver_mutation_configure.go +++ b/pkg/api/resolver_mutation_configure.go @@ -61,6 +61,15 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input models.Co c.Set(config.Generated, input.GeneratedPath) } + if input.MetadataPath != nil { + if *input.MetadataPath != "" { + if err := utils.EnsureDir(*input.MetadataPath); err != nil { + return makeConfigGeneralResult(), err + } + } + c.Set(config.Metadata, input.MetadataPath) + } + if input.CachePath != nil { if *input.CachePath != "" { if err := utils.EnsureDir(*input.CachePath); err != nil { diff --git a/pkg/api/resolver_query_configuration.go b/pkg/api/resolver_query_configuration.go index 55d0a5c99..21eb9adc1 100644 --- a/pkg/api/resolver_query_configuration.go +++ b/pkg/api/resolver_query_configuration.go @@ -59,6 +59,7 @@ func makeConfigGeneralResult() *models.ConfigGeneralResult { Stashes: config.GetStashPaths(), DatabasePath: config.GetDatabasePath(), GeneratedPath: config.GetGeneratedPath(), + MetadataPath: config.GetMetadataPath(), ConfigFilePath: config.GetConfigFilePath(), ScrapersPath: config.GetScrapersPath(), CachePath: config.GetCachePath(), diff --git a/ui/v2.5/src/components/Changelog/versions/v0100.md b/ui/v2.5/src/components/Changelog/versions/v0100.md index 725ae58a0..684ad9832 100644 --- a/ui/v2.5/src/components/Changelog/versions/v0100.md +++ b/ui/v2.5/src/components/Changelog/versions/v0100.md @@ -14,6 +14,7 @@ * Support filtering Movies by Performers. ([#1675](https://github.com/stashapp/stash/pull/1675)) ### 🎨 Improvements +* Support setting metadata import/export directory from UI. ([#1782](https://github.com/stashapp/stash/pull/1782)) * Improved image query performance. ([#1750](https://github.com/stashapp/stash/pull/1750)) * Added movie count to performer and studio cards. ([#1760](https://github.com/stashapp/stash/pull/1760)) * Added date and details to Movie card, and move scene count to icon. ([#1758](https://github.com/stashapp/stash/pull/1758)) diff --git a/ui/v2.5/src/components/Settings/SettingsConfigurationPanel.tsx b/ui/v2.5/src/components/Settings/SettingsConfigurationPanel.tsx index 0b75c1766..be5e0a8a9 100644 --- a/ui/v2.5/src/components/Settings/SettingsConfigurationPanel.tsx +++ b/ui/v2.5/src/components/Settings/SettingsConfigurationPanel.tsx @@ -80,6 +80,9 @@ export const SettingsConfigurationPanel: React.FC = () => { const [generatedPath, setGeneratedPath] = useState( undefined ); + const [metadataPath, setMetadataPath] = useState( + undefined + ); const [cachePath, setCachePath] = useState(undefined); const [calculateMD5, setCalculateMD5] = useState(false); const [videoFileNamingAlgorithm, setVideoFileNamingAlgorithm] = useState< @@ -145,6 +148,7 @@ export const SettingsConfigurationPanel: React.FC = () => { })), databasePath, generatedPath, + metadataPath, cachePath, calculateMD5, videoFileNamingAlgorithm: @@ -191,6 +195,7 @@ export const SettingsConfigurationPanel: React.FC = () => { setStashes(conf.general.stashes ?? []); setDatabasePath(conf.general.databasePath); setGeneratedPath(conf.general.generatedPath); + setMetadataPath(conf.general.metadataPath); setCachePath(conf.general.cachePath); setVideoFileNamingAlgorithm(conf.general.videoFileNamingAlgorithm); setCalculateMD5(conf.general.calculateMD5); @@ -423,6 +428,24 @@ export const SettingsConfigurationPanel: React.FC = () => { + +
+ +
+ ) => + setMetadataPath(e.currentTarget.value) + } + /> + + {intl.formatMessage({ + id: "config.general.metadata_path.description", + })} + +
+
diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index 85fb1bc24..98480e1f8 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -228,6 +228,10 @@ "maximum_streaming_transcode_size_head": "Maximum streaming transcode size", "maximum_transcode_size_desc": "Maximum size for generated transcodes", "maximum_transcode_size_head": "Maximum transcode size", + "metadata_path": { + "heading": "Metadata Path", + "description": "Directory location used when performing a full export or import" + }, "number_of_parallel_task_for_scan_generation_desc": "Set to 0 for auto-detection. Warning running more tasks than is required to achieve 100% cpu utilisation will decrease performance and potentially cause other issues.", "number_of_parallel_task_for_scan_generation_head": "Number of parallel task for scan/generation", "parallel_scan_head": "Parallel Scan/Generation",