mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Combine system preview generation options (#2328)
This commit is contained in:
@@ -51,12 +51,14 @@ export const GenerateDialog: React.FC<ISceneGenerateDialog> = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// combine the defaults with the system preview generation settings
|
||||||
if (configuration?.defaults.generate) {
|
if (configuration?.defaults.generate) {
|
||||||
const { generate } = configuration.defaults;
|
const { generate } = configuration.defaults;
|
||||||
setOptions(withoutTypename(generate));
|
setOptions(withoutTypename(generate));
|
||||||
setConfigRead(true);
|
setConfigRead(true);
|
||||||
} else if (configuration?.general) {
|
}
|
||||||
// backwards compatibility
|
|
||||||
|
if (configuration?.general) {
|
||||||
const { general } = configuration;
|
const { general } = configuration;
|
||||||
setOptions((existing) => ({
|
setOptions((existing) => ({
|
||||||
...existing,
|
...existing,
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ export const LibraryTasks: React.FC = () => {
|
|||||||
type DialogOpenState = typeof dialogOpen;
|
type DialogOpenState = typeof dialogOpen;
|
||||||
|
|
||||||
const { configuration } = React.useContext(ConfigurationContext);
|
const { configuration } = React.useContext(ConfigurationContext);
|
||||||
|
const [configRead, setConfigRead] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!configuration?.defaults) {
|
if (!configuration?.defaults) {
|
||||||
@@ -126,33 +127,41 @@ export const LibraryTasks: React.FC = () => {
|
|||||||
setAutoTagOptions(withoutTypename(autoTag));
|
setAutoTagOptions(withoutTypename(autoTag));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration?.defaults.generate) {
|
// combine the defaults with the system preview generation settings
|
||||||
const { generate } = configuration.defaults;
|
// only do this once
|
||||||
setGenerateOptions(withoutTypename(generate));
|
if (!configRead) {
|
||||||
} else if (configuration?.general) {
|
if (configuration?.defaults.generate) {
|
||||||
// backwards compatibility
|
const { generate } = configuration.defaults;
|
||||||
const { general } = configuration;
|
setGenerateOptions(withoutTypename(generate));
|
||||||
setGenerateOptions((existing) => ({
|
}
|
||||||
...existing,
|
|
||||||
previewOptions: {
|
if (configuration?.general) {
|
||||||
...existing.previewOptions,
|
const { general } = configuration;
|
||||||
previewSegments:
|
setGenerateOptions((existing) => ({
|
||||||
general.previewSegments ?? existing.previewOptions?.previewSegments,
|
...existing,
|
||||||
previewSegmentDuration:
|
previewOptions: {
|
||||||
general.previewSegmentDuration ??
|
...existing.previewOptions,
|
||||||
existing.previewOptions?.previewSegmentDuration,
|
previewSegments:
|
||||||
previewExcludeStart:
|
general.previewSegments ??
|
||||||
general.previewExcludeStart ??
|
existing.previewOptions?.previewSegments,
|
||||||
existing.previewOptions?.previewExcludeStart,
|
previewSegmentDuration:
|
||||||
previewExcludeEnd:
|
general.previewSegmentDuration ??
|
||||||
general.previewExcludeEnd ??
|
existing.previewOptions?.previewSegmentDuration,
|
||||||
existing.previewOptions?.previewExcludeEnd,
|
previewExcludeStart:
|
||||||
previewPreset:
|
general.previewExcludeStart ??
|
||||||
general.previewPreset ?? existing.previewOptions?.previewPreset,
|
existing.previewOptions?.previewExcludeStart,
|
||||||
},
|
previewExcludeEnd:
|
||||||
}));
|
general.previewExcludeEnd ??
|
||||||
|
existing.previewOptions?.previewExcludeEnd,
|
||||||
|
previewPreset:
|
||||||
|
general.previewPreset ?? existing.previewOptions?.previewPreset,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
setConfigRead(true);
|
||||||
}
|
}
|
||||||
}, [configuration]);
|
}, [configuration, configRead]);
|
||||||
|
|
||||||
function setDialogOpen(s: Partial<DialogOpenState>) {
|
function setDialogOpen(s: Partial<DialogOpenState>) {
|
||||||
setDialogOpenState((v) => {
|
setDialogOpenState((v) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user