diff --git a/bin/upscaler.py b/bin/upscaler.py index 1d770f7..1a3ae64 100644 --- a/bin/upscaler.py +++ b/bin/upscaler.py @@ -56,20 +56,22 @@ class Upscaler: self.image_format = 'png' self.preserve_frames = False - # create temporary folder/directories + def create_temp_folders(self): + """create temporary folder/directories + """ self.extracted_frames = tempfile.mkdtemp(dir=self.video2x_cache_folder) Avalon.debug_info('Extracted frames are being saved to: {}'.format(self.extracted_frames)) self.upscaled_frames = tempfile.mkdtemp(dir=self.video2x_cache_folder) Avalon.debug_info('Upscaled frames are being saved to: {}'.format(self.upscaled_frames)) def cleanup(self): - # delete temp directories when done - # avalon framework cannot be used if python is shutting down - # therefore, plain print is used + """delete temp directories when done + """ if not self.preserve_frames: - for directory in [self.extracted_frames, self.upscaled_frames]: try: + # avalon framework cannot be used if python is shutting down + # therefore, plain print is used print('Cleaning up cache directory: {}'.format(directory)) shutil.rmtree(directory) except (OSError, FileNotFoundError): diff --git a/bin/video2x.py b/bin/video2x.py index a3e1d96..d7c1e48 100644 --- a/bin/video2x.py +++ b/bin/video2x.py @@ -52,7 +52,7 @@ import tempfile import time import traceback -VERSION = '2.7.0' +VERSION = '2.7.1' # each thread might take up to 2.5 GB during initialization. # (system memory, not to be confused with GPU memory) @@ -313,7 +313,8 @@ try: upscaler.image_format = image_format upscaler.preserve_frames = preserve_frames - # run upscaler- + # run upscaler + upscaler.create_temp_folders() upscaler.run() upscaler.cleanup() @@ -337,6 +338,7 @@ try: upscaler.preserve_frames = preserve_frames # run upscaler + upscaler.create_temp_folders() upscaler.run() upscaler.cleanup() else: