Updated text shadow

This commit is contained in:
Nayam Amarshe 2023-03-18 18:03:17 +05:30
parent dbab319793
commit 20ad827a8e
10 changed files with 211 additions and 1369 deletions

View File

@ -255,65 +255,35 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
const fileExt = parse(fullfileName).ext; const fileExt = parse(fullfileName).ext;
console.log("🚀 => fileExt", fileExt); console.log("🚀 => fileExt", fileExt);
const outFile = model.includes("models-DF2K") const outFile =
? outputDir + outputDir +
"/" + "/" +
fileName + fileName +
"_sharpened_" + "_upscayl_" +
scale + scale +
"x_" + "x_" +
model + model +
"." + "." +
saveImageAs saveImageAs;
: outputDir +
"/" +
fileName +
"_upscayl_" +
scale +
"x_" +
model +
"." +
saveImageAs;
// UPSCALE // UPSCALE
if (fs.existsSync(outFile)) { if (fs.existsSync(outFile)) {
// If already upscayled, just output that file // If already upscayled, just output that file
mainWindow.webContents.send(commands.UPSCAYL_DONE, outFile); mainWindow.webContents.send(commands.UPSCAYL_DONE, outFile);
} else { } else {
let upscayl: ReturnType<typeof spawnUpscayl>; const upscayl = spawnUpscayl(
"realesrgan",
switch (model) { getSingleImageArguments(
default: inputDir,
upscayl = spawnUpscayl( fullfileName,
"realesrgan", outFile,
getSingleImageArguments( modelsPath,
inputDir, model,
fullfileName, scale,
outFile, gpuId,
modelsPath, saveImageAs
model, )
scale, );
gpuId,
saveImageAs
)
);
break;
case "models-DF2K":
upscayl = spawnUpscayl(
"realsr",
getSingleImageSharpenArguments(
inputDir,
fullfileName,
outFile,
modelsPath,
model,
scale,
gpuId,
saveImageAs
)
);
break;
}
let isAlpha = false; let isAlpha = false;
let failed = false; let failed = false;
@ -363,50 +333,28 @@ ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => {
// GET THE IMAGE DIRECTORY // GET THE IMAGE DIRECTORY
let inputDir = payload.batchFolderPath; let inputDir = payload.batchFolderPath;
console.log("🚀 => file: index.ts => line 471 => inputDir", inputDir);
// GET THE OUTPUT DIRECTORY // GET THE OUTPUT DIRECTORY
let outputDir = model.includes("models-DF2K") let outputDir = payload.outputPath;
? payload.outputPath + "_sharpened"
: payload.outputPath;
console.log("🚀 => file: index.ts => line 474 => outputDir", outputDir);
if (!fs.existsSync(outputDir)) { if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true }); fs.mkdirSync(outputDir, { recursive: true });
} }
// UPSCALE // UPSCALE
let upscayl: ReturnType<typeof spawnUpscayl>; const upscayl = spawnUpscayl(
switch (model) { "realesrgan",
default: getBatchArguments(
upscayl = spawnUpscayl( inputDir,
"realesrgan", outputDir,
getBatchArguments( modelsPath,
inputDir, model,
outputDir, gpuId,
modelsPath, saveImageAs
model, )
gpuId, );
saveImageAs
)
);
break;
case "models-DF2K":
upscayl = spawnUpscayl(
"realsr",
getBatchSharpenArguments(
inputDir,
outputDir,
modelsPath,
model,
gpuId,
saveImageAs
)
);
break;
}
let failed = false; let failed = false;
const onData = (data) => { const onData = (data: any) => {
console.log( console.log(
"🚀 => upscayl.stderr.on => stderr.toString()", "🚀 => upscayl.stderr.on => stderr.toString()",
data.toString() data.toString()
@ -420,7 +368,7 @@ ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => {
failed = true; failed = true;
} }
}; };
const onError = (data) => { const onError = (data: any) => {
mainWindow.webContents.send( mainWindow.webContents.send(
commands.FOLDER_UPSCAYL_PROGRESS, commands.FOLDER_UPSCAYL_PROGRESS,
data.toString() data.toString()

View File

@ -12,21 +12,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const getArguments_1 = require("./utils/getArguments");
// Native // Native
const path_1 = require("path");
const url_1 = require("url");
const child_process_1 = require("child_process");
const fs_1 = __importDefault(require("fs"));
const electron_updater_1 = require("electron-updater"); const electron_updater_1 = require("electron-updater");
const getPlatform_1 = __importDefault(require("./getPlatform")); const getPlatform_1 = __importDefault(require("./getPlatform"));
const upscayl_ffmpeg_1 = __importDefault(require("upscayl-ffmpeg")); const upscayl_ffmpeg_1 = __importDefault(require("upscayl-ffmpeg"));
const path_1 = require("path");
const url_1 = require("url");
const fs_1 = __importDefault(require("fs"));
const binaries_1 = require("./binaries"); const binaries_1 = require("./binaries");
// Packages // Packages
const electron_1 = require("electron"); const electron_1 = require("electron");
const electron_is_dev_1 = __importDefault(require("electron-is-dev"));
const electron_next_1 = __importDefault(require("electron-next"));
const commands_1 = __importDefault(require("./commands"));
const upscayl_1 = require("./upscayl"); const upscayl_1 = require("./upscayl");
const electron_next_1 = __importDefault(require("electron-next"));
const electron_is_dev_1 = __importDefault(require("electron-is-dev"));
const commands_1 = __importDefault(require("./commands"));
// Prepare the renderer once the app is ready // Prepare the renderer once the app is ready
let mainWindow; let mainWindow;
electron_1.app.on("ready", () => __awaiter(void 0, void 0, void 0, function* () { electron_1.app.on("ready", () => __awaiter(void 0, void 0, void 0, function* () {
@ -111,7 +111,7 @@ electron_1.ipcMain.on(commands_1.default.OPEN_FOLDER, (event, payload) => __awai
//------------------------Double Upscayl-----------------------------// //------------------------Double Upscayl-----------------------------//
electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __awaiter(void 0, void 0, void 0, function* () { electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __awaiter(void 0, void 0, void 0, function* () {
const model = payload.model; const model = payload.model;
let inputDir = payload.imagePath.match(/(.*)[\/\\]/)[1] || ""; let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "");
let outputDir = payload.outputPath; let outputDir = payload.outputPath;
const gpuId = payload.gpuId; const gpuId = payload.gpuId;
const saveImageAs = payload.saveImageAs; const saveImageAs = payload.saveImageAs;
@ -122,28 +122,13 @@ electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __a
: payload.imagePath.split("/").slice(-1)[0]; : payload.imagePath.split("/").slice(-1)[0];
const fileName = (0, path_1.parse)(fullfileName).name; const fileName = (0, path_1.parse)(fullfileName).name;
const fileExt = (0, path_1.parse)(fullfileName).ext; const fileExt = (0, path_1.parse)(fullfileName).ext;
const outFile = outputDir + "/" + fileName + "_upscayl_8x_" + model + "." + saveImageAs; const outFile = outputDir + "/" + fileName + "_upscayl_16x_" + model + "." + saveImageAs;
const commandArguments = [
"-i",
inputDir + "/" + fullfileName,
"-o",
outFile,
"-s",
4,
"-m",
binaries_1.modelsPath,
"-n",
model,
gpuId ? `-g ${gpuId}` : "",
"-f",
saveImageAs,
];
// UPSCALE // UPSCALE
let upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", commandArguments).process; let upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getDoubleUpscaleArguments)(inputDir, fullfileName, outFile, binaries_1.modelsPath, model, gpuId, saveImageAs));
let failed = false; let failed = false;
let isAlpha = false; let isAlpha = false;
// TAKE UPSCAYL OUTPUT let failed2 = false;
upscayl.stderr.on("data", (data) => { const onData = (data) => {
// CONVERT DATA TO STRING // CONVERT DATA TO STRING
data = data.toString(); data = data.toString();
// PRINT TO CONSOLE // PRINT TO CONSOLE
@ -154,70 +139,54 @@ electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __a
if (data.includes("invalid gpu") || data.includes("failed")) { if (data.includes("invalid gpu") || data.includes("failed")) {
failed = true; failed = true;
} }
// IF IMAGE HAS ALPHA CHANNEL
if (data.includes("has alpha channel")) { if (data.includes("has alpha channel")) {
isAlpha = true; isAlpha = true;
} }
}); };
// IF ERROR const onError = (data) => {
upscayl.on("error", (data) => {
data.toString(); data.toString();
// SEND UPSCAYL PROGRESS TO RENDERER // SEND UPSCAYL PROGRESS TO RENDERER
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data); mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
// SET FAILED TO TRUE // SET FAILED TO TRUE
failed = true; failed = true;
return; return;
}); };
// ON UPSCAYL DONE const onData2 = (data) => {
upscayl.on("close", () => { // CONVERT DATA TO STRING
data = data.toString();
// PRINT TO CONSOLE
console.log(data);
// SEND UPSCAYL PROGRESS TO RENDERER
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
if (data.includes("invalid gpu") || data.includes("failed")) {
failed2 = true;
}
};
const onError2 = (data) => {
data.toString();
// SEND UPSCAYL PROGRESS TO RENDERER
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
// SET FAILED TO TRUE
failed2 = true;
return;
};
const onClose2 = (code) => {
if (!failed2) {
console.log("Done upscaling");
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_DONE, isAlpha ? outFile + ".png" : outFile);
}
};
upscayl.process.stderr.on("data", onData);
upscayl.process.on("error", onError);
upscayl.process.on("close", (code) => {
// IF NOT FAILED // IF NOT FAILED
if (!failed) { if (!failed) {
const commandArguments2 = [
"-i",
isAlpha ? outFile + ".png" : outFile,
"-o",
isAlpha ? outFile + ".png" : outFile,
"-s",
4,
"-m",
binaries_1.modelsPath,
"-n",
model,
gpuId ? `-g ${gpuId}` : "",
"-f",
isAlpha ? "" : saveImageAs,
];
// UPSCALE // UPSCALE
let upscayl2 = (0, upscayl_1.spawnUpscayl)("realesrgan", commandArguments2).process; let upscayl2 = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getDoubleUpscaleSecondPassArguments)(isAlpha, outFile, binaries_1.modelsPath, model, gpuId, saveImageAs));
let failed2 = false; upscayl2.process.stderr.on("data", onData2);
// TAKE UPSCAYL OUTPUT upscayl2.process.on("error", onError2);
upscayl2.stderr.on("data", (data) => { upscayl2.process.on("close", onClose2);
// CONVERT DATA TO STRING
data = data.toString();
// PRINT TO CONSOLE
console.log(data);
// SEND UPSCAYL PROGRESS TO RENDERER
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
if (data.includes("invalid gpu") || data.includes("failed")) {
failed2 = true;
}
});
// IF ERROR
upscayl2.on("error", (data) => {
data.toString();
// SEND UPSCAYL PROGRESS TO RENDERER
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
// SET FAILED TO TRUE
failed2 = true;
return;
});
upscayl2.on("close", (code) => {
if (!failed2) {
console.log("Done upscaling");
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_DONE, isAlpha ? outFile + ".png" : outFile);
}
});
} }
}); });
})); }));
@ -227,7 +196,7 @@ electron_1.ipcMain.on(commands_1.default.UPSCAYL, (event, payload) => __awaiter(
const scale = payload.scaleFactor; const scale = payload.scaleFactor;
const gpuId = payload.gpuId; const gpuId = payload.gpuId;
const saveImageAs = payload.saveImageAs; const saveImageAs = payload.saveImageAs;
let inputDir = payload.imagePath.match(/(.*)[\/\\]/)[1] || ""; let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "");
let outputDir = payload.outputPath; let outputDir = payload.outputPath;
// COPY IMAGE TO TMP FOLDER // COPY IMAGE TO TMP FOLDER
const fullfileName = payload.imagePath.replace(/^.*[\\\/]/, ""); const fullfileName = payload.imagePath.replace(/^.*[\\\/]/, "");
@ -235,69 +204,22 @@ electron_1.ipcMain.on(commands_1.default.UPSCAYL, (event, payload) => __awaiter(
console.log("🚀 => fileName", fileName); console.log("🚀 => fileName", fileName);
const fileExt = (0, path_1.parse)(fullfileName).ext; const fileExt = (0, path_1.parse)(fullfileName).ext;
console.log("🚀 => fileExt", fileExt); console.log("🚀 => fileExt", fileExt);
const outFile = model.includes("models-DF2K") const outFile = outputDir +
? outputDir + "/" +
"/" + fileName +
fileName + "_upscayl_" +
"_sharpened_" + scale +
scale + "x_" +
"x_" + model +
model + "." +
"." + saveImageAs;
saveImageAs
: outputDir +
"/" +
fileName +
"_upscayl_" +
scale +
"x_" +
model +
"." +
saveImageAs;
// UPSCALE // UPSCALE
if (fs_1.default.existsSync(outFile)) { if (fs_1.default.existsSync(outFile)) {
// If already upscayled, just output that file // If already upscayled, just output that file
mainWindow.webContents.send(commands_1.default.UPSCAYL_DONE, outFile); mainWindow.webContents.send(commands_1.default.UPSCAYL_DONE, outFile);
} }
else { else {
let upscayl; const upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getSingleImageArguments)(inputDir, fullfileName, outFile, binaries_1.modelsPath, model, scale, gpuId, saveImageAs));
const defaultArguments = [
"-i",
inputDir + "/" + fullfileName,
"-o",
outFile,
"-s",
scale === 2 ? 4 : scale,
"-m",
binaries_1.modelsPath,
"-n",
model,
gpuId ? `-g ${gpuId}` : "",
"-f",
saveImageAs,
];
const sharpenArguments = [
"-i",
inputDir + "/" + fullfileName,
"-o",
outFile,
"-s",
scale,
"-x",
"-m",
binaries_1.modelsPath + "/" + model,
gpuId ? `-g ${gpuId}` : "",
"-f",
saveImageAs,
];
switch (model) {
default:
upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", defaultArguments);
break;
case "models-DF2K":
upscayl = (0, upscayl_1.spawnUpscayl)("realsr", sharpenArguments);
break;
}
let isAlpha = false; let isAlpha = false;
let failed = false; let failed = false;
const onData = (data) => { const onData = (data) => {
@ -336,158 +258,46 @@ electron_1.ipcMain.on(commands_1.default.FOLDER_UPSCAYL, (event, payload) => __a
const saveImageAs = payload.saveImageAs; const saveImageAs = payload.saveImageAs;
// GET THE IMAGE DIRECTORY // GET THE IMAGE DIRECTORY
let inputDir = payload.batchFolderPath; let inputDir = payload.batchFolderPath;
console.log("🚀 => file: index.ts => line 471 => inputDir", inputDir);
// GET THE OUTPUT DIRECTORY // GET THE OUTPUT DIRECTORY
let outputDir = model.includes("models-DF2K") let outputDir = payload.outputPath;
? payload.outputPath + "_sharpened"
: payload.outputPath;
console.log("🚀 => file: index.ts => line 474 => outputDir", outputDir);
if (!fs_1.default.existsSync(outputDir)) { if (!fs_1.default.existsSync(outputDir)) {
fs_1.default.mkdirSync(outputDir, { recursive: true }); fs_1.default.mkdirSync(outputDir, { recursive: true });
} }
const commandArguments = [
"-i",
inputDir,
"-o",
outputDir,
"-s",
4,
"-m",
binaries_1.modelsPath,
"-n",
model,
gpuId ? `-g ${gpuId}` : "",
"-f",
saveImageAs,
];
const sharpenArguments = [
"-i",
inputDir,
"-o",
outputDir,
"-s",
4,
"-x",
"-m",
binaries_1.modelsPath + "/" + model,
gpuId ? `-g ${gpuId}` : "",
"-f",
saveImageAs,
];
// UPSCALE // UPSCALE
let upscayl = null; const upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getBatchArguments)(inputDir, outputDir, binaries_1.modelsPath, model, gpuId, saveImageAs));
switch (model) {
default:
upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", commandArguments).process;
break;
case "models-DF2K":
upscayl = (0, upscayl_1.spawnUpscayl)("realsr", sharpenArguments).process;
break;
}
let failed = false; let failed = false;
upscayl === null || upscayl === void 0 ? void 0 : upscayl.stderr.on("data", (data) => { const onData = (data) => {
console.log("🚀 => upscayl.stderr.on => stderr.toString()", data.toString()); console.log("🚀 => upscayl.stderr.on => stderr.toString()", data.toString());
data = data.toString(); data = data.toString();
mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString()); mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString());
if (data.includes("invalid gpu") || data.includes("failed")) { if (data.includes("invalid gpu") || data.includes("failed")) {
failed = true; failed = true;
} }
}); };
upscayl === null || upscayl === void 0 ? void 0 : upscayl.on("error", (data) => { const onError = (data) => {
mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString()); mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString());
failed = true; failed = true;
return; return;
}); };
// Send done comamnd when const onClose = () => {
upscayl === null || upscayl === void 0 ? void 0 : upscayl.on("close", (code) => {
if (failed !== true) { if (failed !== true) {
console.log("Done upscaling"); console.log("Done upscaling");
mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_DONE, outputDir); mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_DONE, outputDir);
} }
}); };
})); upscayl.process.stderr.on("data", onData);
//------------------------Video Upscayl-----------------------------// upscayl.process.on("error", onError);
electron_1.ipcMain.on(commands_1.default.UPSCAYL_VIDEO, (event, payload) => __awaiter(void 0, void 0, void 0, function* () { upscayl.process.on("close", onClose);
// Extract the model
const model = payload.model;
// Extract the Video Directory
let videoFileName = payload.videoPath.replace(/^.*[\\\/]/, "");
const justFileName = (0, path_1.parse)(videoFileName).name;
let inputDir = payload.videoPath.match(/(.*)[\/\\]/)[1] || "";
console.log("🚀 => file: index.ts => line 337 => inputDir", inputDir);
// Set the output directory
let outputDir = payload.outputPath + "_frames";
console.log("🚀 => file: index.ts => line 340 => outputDir", outputDir);
let frameExtractionPath = (0, path_1.join)(inputDir, justFileName + "_f");
let frameUpscalePath = (0, path_1.join)(inputDir, justFileName + "_u");
console.log("🚀 => file: index.ts => line 342 => frameExtractionPath", frameExtractionPath, frameUpscalePath);
if (!fs_1.default.existsSync(frameExtractionPath)) {
fs_1.default.mkdirSync(frameExtractionPath, { recursive: true });
}
if (!fs_1.default.existsSync(frameUpscalePath)) {
fs_1.default.mkdirSync(frameUpscalePath, { recursive: true });
}
let ffmpegProcess = null;
ffmpegProcess = (0, child_process_1.spawn)(upscayl_ffmpeg_1.default.path, [
"-i",
inputDir + "/" + videoFileName,
frameExtractionPath + "/" + "out%d.png",
], {
cwd: undefined,
detached: false,
});
let failed = false;
ffmpegProcess === null || ffmpegProcess === void 0 ? void 0 : ffmpegProcess.stderr.on("data", (data) => {
console.log("🚀 => file: index.ts:420 => data", data.toString());
data = data.toString();
mainWindow.webContents.send(commands_1.default.FFMPEG_VIDEO_PROGRESS, data.toString());
});
ffmpegProcess === null || ffmpegProcess === void 0 ? void 0 : ffmpegProcess.on("error", (data) => {
mainWindow.webContents.send(commands_1.default.FFMPEG_VIDEO_PROGRESS, data.toString());
failed = true;
return;
});
// Send done comamnd when
ffmpegProcess === null || ffmpegProcess === void 0 ? void 0 : ffmpegProcess.on("close", (code) => {
if (failed !== true) {
console.log("Frame extraction successful!");
mainWindow.webContents.send(commands_1.default.FFMPEG_VIDEO_DONE, outputDir);
// UPSCALE
let upscayl = null;
upscayl = (0, child_process_1.spawn)((0, binaries_1.execPath)("realesrgan"), [
"-i",
frameExtractionPath,
"-o",
frameUpscalePath,
"-s",
4,
"-m",
binaries_1.modelsPath,
"-n",
model,
], {
cwd: undefined,
detached: false,
});
upscayl === null || upscayl === void 0 ? void 0 : upscayl.stderr.on("data", (data) => {
console.log("🚀 => upscayl.stderr.on => stderr.toString()", data.toString());
data = data.toString();
mainWindow.webContents.send(commands_1.default.FFMPEG_VIDEO_PROGRESS, data.toString());
});
}
});
})); }));
//------------------------Auto-Update Code-----------------------------// //------------------------Auto-Update Code-----------------------------//
// ! AUTO UPDATE STUFF // ! AUTO UPDATE STUFF
electron_updater_1.autoUpdater.on("update-available", ({ releaseNotes, releaseName }) => { electron_updater_1.autoUpdater.on("update-available", ({ releaseNotes, releaseName }) => {
const dialogOpts = { const dialogOpts = {
type: "info", type: "info",
buttons: ["Ok"], buttons: ["Ok cool"],
title: "Application Update", title: "New Upscayl Update",
message: process.platform === "win32" message: releaseName,
? releaseNotes detail: "A new version is being downloaded. Please check GitHub for more details.",
: releaseName,
detail: "A new version is being downloaded.",
}; };
electron_1.dialog.showMessageBox(dialogOpts).then((returnValue) => { }); electron_1.dialog.showMessageBox(dialogOpts).then((returnValue) => { });
}); });
@ -495,10 +305,8 @@ electron_updater_1.autoUpdater.on("update-downloaded", (event) => {
const dialogOpts = { const dialogOpts = {
type: "info", type: "info",
buttons: ["Restart", "Later"], buttons: ["Restart", "Later"],
title: "Application Update", title: "New Upscayl Update",
message: process.platform === "win32" message: event.releaseName,
? event.releaseNotes
: event.releaseName,
detail: "A new version has been downloaded. Restart the application to apply the updates.", detail: "A new version has been downloaded. Restart the application to apply the updates.",
}; };
electron_1.dialog.showMessageBox(dialogOpts).then((returnValue) => { electron_1.dialog.showMessageBox(dialogOpts).then((returnValue) => {
@ -506,3 +314,98 @@ electron_updater_1.autoUpdater.on("update-downloaded", (event) => {
electron_updater_1.autoUpdater.quitAndInstall(); electron_updater_1.autoUpdater.quitAndInstall();
}); });
}); });
//------------------------Video Upscayl-----------------------------//
// ipcMain.on(commands.UPSCAYL_VIDEO, async (event, payload) => {
// // Extract the model
// const model = payload.model;
// // Extract the Video Directory
// let videoFileName = payload.videoPath.replace(/^.*[\\\/]/, "");
// const justFileName = parse(videoFileName).name;
// let inputDir = payload.videoPath.match(/(.*)[\/\\]/)[1] || "";
// console.log("🚀 => file: index.ts => line 337 => inputDir", inputDir);
// // Set the output directory
// let outputDir = payload.outputPath + "_frames";
// console.log("🚀 => file: index.ts => line 340 => outputDir", outputDir);
// let frameExtractionPath = join(inputDir, justFileName + "_f");
// let frameUpscalePath = join(inputDir, justFileName + "_u");
// console.log(
// "🚀 => file: index.ts => line 342 => frameExtractionPath",
// frameExtractionPath,
// frameUpscalePath
// );
// if (!fs.existsSync(frameExtractionPath)) {
// fs.mkdirSync(frameExtractionPath, { recursive: true });
// }
// if (!fs.existsSync(frameUpscalePath)) {
// fs.mkdirSync(frameUpscalePath, { recursive: true });
// }
// let ffmpegProcess: ChildProcessWithoutNullStreams | null = null;
// ffmpegProcess = spawn(
// ffmpeg.path,
// [
// "-i",
// inputDir + "/" + videoFileName,
// frameExtractionPath + "/" + "out%d.png",
// ],
// {
// cwd: undefined,
// detached: false,
// }
// );
// let failed = false;
// ffmpegProcess?.stderr.on("data", (data: string) => {
// console.log("🚀 => file: index.ts:420 => data", data.toString());
// data = data.toString();
// mainWindow.webContents.send(
// commands.FFMPEG_VIDEO_PROGRESS,
// data.toString()
// );
// });
// ffmpegProcess?.on("error", (data: string) => {
// mainWindow.webContents.send(
// commands.FFMPEG_VIDEO_PROGRESS,
// data.toString()
// );
// failed = true;
// return;
// });
// // Send done comamnd when
// ffmpegProcess?.on("close", (code: number) => {
// if (failed !== true) {
// console.log("Frame extraction successful!");
// mainWindow.webContents.send(commands.FFMPEG_VIDEO_DONE, outputDir);
// // UPSCALE
// let upscayl: ChildProcessWithoutNullStreams | null = null;
// upscayl = spawn(
// execPath("realesrgan"),
// [
// "-i",
// frameExtractionPath,
// "-o",
// frameUpscalePath,
// "-s",
// 4,
// "-m",
// modelsPath,
// "-n",
// model,
// ],
// {
// cwd: undefined,
// detached: false,
// }
// );
// upscayl?.stderr.on("data", (data) => {
// console.log(
// "🚀 => upscayl.stderr.on => stderr.toString()",
// data.toString()
// );
// data = data.toString();
// mainWindow.webContents.send(
// commands.FFMPEG_VIDEO_PROGRESS,
// data.toString()
// );
// });
// }
// });
// });

View File

@ -136,7 +136,6 @@ function LeftPaneImageSteps({
{ label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" }, { label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" },
{ label: "General Photo (Ultrasharp)", value: "ultrasharp" }, { label: "General Photo (Ultrasharp)", value: "ultrasharp" },
{ label: "Digital Art", value: "realesrgan-x4plus-anime" }, { label: "Digital Art", value: "realesrgan-x4plus-anime" },
{ label: "Sharpen Image", value: "models-DF2K" },
]; ];
const availableThemes = [ const availableThemes = [
@ -218,7 +217,7 @@ function LeftPaneImageSteps({
value={currentModel} value={currentModel}
/> />
{model !== "models-DF2K" && !batchMode && ( {!batchMode && (
<div className="mt-4 flex items-center gap-1"> <div className="mt-4 flex items-center gap-1">
<input <input
type="checkbox" type="checkbox"

View File

@ -244,9 +244,6 @@ const Home = () => {
"model", "model",
JSON.stringify({ label: e.label, value: e.value }) JSON.stringify({ label: e.label, value: e.value })
); );
if (e.value === "models-DF2K") {
setDoubleUpscayl(false);
}
}; };
// DRAG AND DROP HANDLERS // DRAG AND DROP HANDLERS
@ -335,9 +332,6 @@ const Home = () => {
if (!isVideo && (imagePath !== "" || batchFolderPath !== "")) { if (!isVideo && (imagePath !== "" || batchFolderPath !== "")) {
setProgress("Hold on..."); setProgress("Hold on...");
if (model === "models-DF2K") {
setDoubleUpscayl(false);
}
if (doubleUpscayl) { if (doubleUpscayl) {
await window.electron.send(commands.DOUBLE_UPSCAYL, { await window.electron.send(commands.DOUBLE_UPSCAYL, {

View File

@ -120,9 +120,8 @@
} }
.outline-title { .outline-title {
text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5), text-shadow: 0px 0px 10px rgba(255, 255, 255, 0.5),
-1px -1px 0 rgba(255, 255, 255, 0.5), 1px -1px 0 rgba(255, 255, 255, 0.5), 0px 0px 10px rgba(255, 255, 255, 1);
-1px 1px 0 rgba(255, 255, 255, 0.5), 1px 1px 0 rgba(255, 255, 255, 0.5);
} }
.outline-title-none { .outline-title-none {
text-shadow: none; text-shadow: none;

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.