mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-28 06:59:11 +00:00
fixed temp folders bug
This commit is contained in:
parent
6538abd6e5
commit
837aca371e
@ -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):
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user