mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-10-31 21:00:58 +01:00
fixed tempfile error caused by image cleaner
This commit is contained in:
parent
49d0dbdabf
commit
c59d113a11
@ -13,13 +13,13 @@ Licensed under the GNU General Public License Version 3 (GNU GPL v3),
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from avalon_framework import Avalon
|
from avalon_framework import Avalon
|
||||||
|
from image_cleaner import ImageCleaner
|
||||||
from exceptions import *
|
from exceptions import *
|
||||||
from ffmpeg import Ffmpeg
|
from ffmpeg import Ffmpeg
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from waifu2x_caffe import Waifu2xCaffe
|
from waifu2x_caffe import Waifu2xCaffe
|
||||||
from waifu2x_converter import Waifu2xConverter
|
from waifu2x_converter import Waifu2xConverter
|
||||||
from clear_image import ClearImage
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@ -74,10 +74,13 @@ class Upscaler:
|
|||||||
# avalon framework cannot be used if python is shutting down
|
# avalon framework cannot be used if python is shutting down
|
||||||
# therefore, plain print is used
|
# therefore, plain print is used
|
||||||
if not self.preserve_frames:
|
if not self.preserve_frames:
|
||||||
print('Cleaning up cache directory: {}'.format(self.extracted_frames))
|
try:
|
||||||
self.extracted_frames_object.cleanup()
|
print('Cleaning up cache directory: {}'.format(self.extracted_frames))
|
||||||
print('Cleaning up cache directory: {}'.format(self.upscaled_frames))
|
self.extracted_frames_object.cleanup()
|
||||||
self.upscaled_frames_object.cleanup()
|
print('Cleaning up cache directory: {}'.format(self.upscaled_frames))
|
||||||
|
self.upscaled_frames_object.cleanup()
|
||||||
|
except (OSError, FileNotFoundError):
|
||||||
|
pass
|
||||||
|
|
||||||
def _check_arguments(self):
|
def _check_arguments(self):
|
||||||
# check if arguments are valid / all necessary argument
|
# check if arguments are valid / all necessary argument
|
||||||
@ -209,11 +212,11 @@ class Upscaler:
|
|||||||
progress_bar = threading.Thread(target=self._progress_bar, args=(thread_folders,))
|
progress_bar = threading.Thread(target=self._progress_bar, args=(thread_folders,))
|
||||||
progress_bar.start()
|
progress_bar.start()
|
||||||
|
|
||||||
#Create the clearer and start it
|
# create the clearer and start it
|
||||||
Avalon.debug_info('Starting image clearer...')
|
Avalon.debug_info('Starting upscaled image cleaner')
|
||||||
image_clear = ClearImage(self.extracted_frames,self.upscaled_frames,len(upscaler_threads))
|
image_cleaner = ImageCleaner(self.extracted_frames, self.upscaled_frames, len(upscaler_threads))
|
||||||
image_clear.start()
|
image_cleaner.start()
|
||||||
|
|
||||||
# start all threads
|
# start all threads
|
||||||
for thread in upscaler_threads:
|
for thread in upscaler_threads:
|
||||||
thread.start()
|
thread.start()
|
||||||
@ -221,10 +224,10 @@ class Upscaler:
|
|||||||
# wait for threads to finish
|
# wait for threads to finish
|
||||||
for thread in upscaler_threads:
|
for thread in upscaler_threads:
|
||||||
thread.join()
|
thread.join()
|
||||||
|
|
||||||
#upscaling done... kill the clearer
|
# upscaling done, kill the clearer
|
||||||
Avalon.debug_info('Stoping image clearer...')
|
Avalon.debug_info('Killing upscaled image cleaner')
|
||||||
image_clear.stop()
|
image_cleaner.stop()
|
||||||
|
|
||||||
self.progress_bar_exit_signal = True
|
self.progress_bar_exit_signal = True
|
||||||
|
|
||||||
@ -300,5 +303,3 @@ class Upscaler:
|
|||||||
# migrate audio tracks and subtitles
|
# migrate audio tracks and subtitles
|
||||||
Avalon.info('Migrating audio tracks and subtitles to upscaled video')
|
Avalon.info('Migrating audio tracks and subtitles to upscaled video')
|
||||||
fm.migrate_audio_tracks_subtitles(self.input_video, self.output_video, self.upscaled_frames)
|
fm.migrate_audio_tracks_subtitles(self.input_video, self.output_video, self.upscaled_frames)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user