1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-30 18:24:27 +01:00

Add batch progress counter

This commit is contained in:
Nayam Amarshe 2023-09-09 17:48:00 +05:30
parent a03d70a938
commit 883171a99f
3 changed files with 17 additions and 1 deletions

View File

@ -517,6 +517,8 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
if (!failed && !stopped) { if (!failed && !stopped) {
logit("💯 Done upscaling"); logit("💯 Done upscaling");
logit("♻ Scaling and converting now..."); logit("♻ Scaling and converting now...");
mainWindow &&
mainWindow.webContents.send(commands.SCALING_AND_CONVERTING);
// Free up memory // Free up memory
upscayl.kill(); upscayl.kill();
try { try {
@ -644,6 +646,8 @@ ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => {
logit("💯 Done upscaling"); logit("💯 Done upscaling");
logit("♻ Scaling and converting now..."); logit("♻ Scaling and converting now...");
upscayl.kill(); upscayl.kill();
mainWindow &&
mainWindow.webContents.send(commands.SCALING_AND_CONVERTING);
// Get number of files in output folder // Get number of files in output folder
const files = fs.readdirSync(inputDir); const files = fs.readdirSync(inputDir);
try { try {

View File

@ -7,12 +7,20 @@ function ProgressBar({
stopHandler, stopHandler,
batchMode, batchMode,
}) { }) {
const [batchProgress, setBatchProgress] = React.useState(0);
React.useEffect(() => {
if (progress.includes("0.00%")) {
setBatchProgress((prev) => prev + 1);
}
}, [progress]);
return ( return (
<div className="absolute flex h-full w-full flex-col items-center justify-center bg-base-300/50 backdrop-blur-lg"> <div className="absolute flex h-full w-full flex-col items-center justify-center bg-base-300/50 backdrop-blur-lg">
<div className="flex flex-col items-center gap-2"> <div className="flex flex-col items-center gap-2">
<Spinner /> <Spinner />
<p className="rounded-full bg-base-300 px-2 py-1 font-bold"> <p className="rounded-full bg-base-300 px-2 py-1 font-bold">
{batchMode && "In Progress"} {batchMode && "Batch Upscale In Progress: " + batchProgress}
{!batchMode && {!batchMode &&
(doubleUpscaylCounter > 0 (doubleUpscaylCounter > 0
? `${progress}\nPass ${doubleUpscaylCounter}` ? `${progress}\nPass ${doubleUpscaylCounter}`

View File

@ -102,6 +102,10 @@ const Home = () => {
logit(`🐞 BACKEND REPORTED: `, data); logit(`🐞 BACKEND REPORTED: `, data);
}); });
window.electron.on(commands.SCALING_AND_CONVERTING, (_, data: string) => {
setProgress("Processing the image...");
});
window.electron.on(commands.UPSCAYL_ERROR, (_, data: string) => { window.electron.on(commands.UPSCAYL_ERROR, (_, data: string) => {
alert(data); alert(data);
resetImagePaths(); resetImagePaths();