Refactor code and remove config vars to fix ASCII path decoding

This commit is contained in:
Nayam Amarshe
2024-04-25 00:59:51 +05:30
parent 618b46f553
commit 5feabea516
15 changed files with 142 additions and 159 deletions

View File

@@ -40,12 +40,6 @@ export function setRememberOutputFolder(value: boolean): void {
logit("💾 Updating Remember Output Folder: ", rememberOutputFolder);
}
export let savedCompression = 0;
export function setCompression(value: number): void {
savedCompression = value;
logit("📐 Updating Compression: ", savedCompression);
}
export let stopped = false;
export let childProcesses: {
process: ChildProcessWithoutNullStreams;
@@ -148,14 +142,7 @@ export function fetchLocalStorage(): void {
setRememberOutputFolder(lastSaveOutputFolder);
}
});
// GET IMAGE COMPRESSION (NUMBER) FROM LOCAL STORAGE
mainWindow.webContents
.executeJavaScript('localStorage.getItem("compression");', true)
.then((lastSavedCompression: string | null) => {
if (lastSavedCompression !== null) {
setCompression(parseInt(lastSavedCompression));
}
});
// GET PROCESS IMAGE (BOOLEAN) FROM LOCAL STORAGE
mainWindow.webContents
.executeJavaScript('localStorage.getItem("noImageProcessing");', true)

View File

@@ -5,7 +5,7 @@ const slash: string = getPlatform() === "win" ? "\\" : "/";
export const getSingleImageArguments = ({
inputDir,
fullfileName,
fileNameWithExt,
outFile,
modelsPath,
model,
@@ -15,7 +15,7 @@ export const getSingleImageArguments = ({
customWidth,
}: {
inputDir: string;
fullfileName: string;
fileNameWithExt: string;
outFile: string;
modelsPath: string;
model: string;
@@ -29,7 +29,7 @@ export const getSingleImageArguments = ({
return [
// INPUT IMAGE
"-i",
inputDir + slash + fullfileName,
inputDir + slash + fileNameWithExt,
// OUTPUT IMAGE
"-o",
outFile,
@@ -109,6 +109,7 @@ export const getDoubleUpscaleSecondPassArguments = ({
saveImageAs: ImageFormat;
scale: string;
customWidth: string;
compression: string;
}) => {
const modelScale = (parseInt(getModelScale(model)) ** 2).toString();
let includeScale = modelScale !== scale && !customWidth;