From 2ba0e951f961cc900273795c677cbd880e201340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=83=E7=A0=B4=E9=BB=91=E5=A4=9C?= <179971b@gmail.com> Date: Tue, 17 Mar 2020 22:01:56 +0800 Subject: [PATCH] Fix k4yt3x#211 bug --- src/image_cleaner.py | 10 ++++------ src/video2x.py | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/image_cleaner.py b/src/image_cleaner.py index 50a03bf..c2df042 100755 --- a/src/image_cleaner.py +++ b/src/image_cleaner.py @@ -58,7 +58,7 @@ class ImageCleaner(threading.Thread): """ # list all images in the extracted frames - output_frames = [f for f in self.output_directory.iterdir() if f.is_file()] + output_frames = [f.name for f in self.output_directory.iterdir() if f.is_file()] # compare and remove frames downscaled images that finished being upscaled # within each thread's extracted frames directory @@ -67,10 +67,8 @@ class ImageCleaner(threading.Thread): # for each file within all the directories for file in dir_path.iterdir(): - file_path = dir_path / file - # if file also exists in the output directory, then the file # has already been processed, thus not needed anymore - if file_path.is_file() and file in output_frames: - file_path.unlink(file) - output_frames.remove(file) + if file.is_file() and file.name in output_frames: + file.unlink() + output_frames.remove(file.name) diff --git a/src/video2x.py b/src/video2x.py index a800909..c26d108 100755 --- a/src/video2x.py +++ b/src/video2x.py @@ -352,7 +352,7 @@ image_format = config['video2x']['image_format'].lower() preserve_frames = config['video2x']['preserve_frames'] # load cache directory -if isinstance(config['video2x']['video2x_cache_directory'], str): +if config['video2x']['video2x_cache_directory'] is not None: video2x_cache_directory = pathlib.Path(config['video2x']['video2x_cache_directory']) else: video2x_cache_directory = pathlib.Path(tempfile.gettempdir()) / 'video2x'