From 0f1b76b1a424d002a543b165c767dcde06d29deb Mon Sep 17 00:00:00 2001 From: TNTwise Date: Sat, 14 Sep 2024 23:22:49 -0500 Subject: [PATCH] remove pause file after every render --- REAL-Video-Enhancer.py | 1 + backend/src/FFmpeg.py | 1 + backend/src/RenderVideo.py | 5 +++-- backend/src/Util.py | 6 +++++- src/Util.py | 5 ++++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/REAL-Video-Enhancer.py b/REAL-Video-Enhancer.py index 028912f0..97e9792d 100644 --- a/REAL-Video-Enhancer.py +++ b/REAL-Video-Enhancer.py @@ -42,6 +42,7 @@ videosPath, checkForWritePermissions, getAvailableDiskSpace, + removeFile, ) from src.ui.ProcessTab import ProcessTab from src.ui.DownloadTab import DownloadTab diff --git a/backend/src/FFmpeg.py b/backend/src/FFmpeg.py index 1ddb9896..5e4df1f4 100644 --- a/backend/src/FFmpeg.py +++ b/backend/src/FFmpeg.py @@ -394,4 +394,5 @@ def writeOutVideoFrames(self): renderTime = time.time() - self.startTime self.writingDone = True + printAndLog(f"\nTime to complete render: {round(renderTime, 2)}") diff --git a/backend/src/RenderVideo.py b/backend/src/RenderVideo.py index a656cf7a..e9fac1b5 100644 --- a/backend/src/RenderVideo.py +++ b/backend/src/RenderVideo.py @@ -8,7 +8,7 @@ from .FFmpeg import FFMpegRender from .SceneDetect import SceneDetect -from .Util import printAndLog, log +from .Util import printAndLog, log, removeFile from .NPMean import NPMeanSequential # try/except imports @@ -177,6 +177,7 @@ def renderUpscale(self): else: sleep(1) self.writeQueue.put(None) + removeFile(self.pausedFile) log("Finished Upscale") def renderInterpolate(self): @@ -243,7 +244,7 @@ def renderInterpolate(self): frameNum+=1 else: sleep(1) - + removeFile(self.pausedFile) self.writeQueue.put(None) log("Finished Interpolation") diff --git a/backend/src/Util.py b/backend/src/Util.py index ddf4fdce..7f3598ae 100644 --- a/backend/src/Util.py +++ b/backend/src/Util.py @@ -24,7 +24,11 @@ def isFlatpak(): cwd = os.getcwd() with open(os.path.join(cwd, "backend_log.txt"), "w") as f: pass - +def removeFile(file): + try: + os.remove(file) + except: + print("Failed to remove file!") def warnAndLog(message: str): warnings.warn(message) diff --git a/src/Util.py b/src/Util.py index 038bfc97..076a8d20 100644 --- a/src/Util.py +++ b/src/Util.py @@ -251,7 +251,10 @@ def currentDirectory(): def removeFile(file): - os.remove(file) + try: + os.remove(file) + except: + print("Failed to remove file!") def checkIfDeps() -> bool: