unified all "folder/directory" into "directory" to end this mess

This commit is contained in:
k4yt3x 2019-04-29 00:06:54 -04:00
parent 0af68bb39c
commit c7353c4bf2
8 changed files with 93 additions and 94 deletions

View File

@ -4,7 +4,7 @@
Name: FFMPEG Class Name: FFMPEG Class
Author: K4YT3X Author: K4YT3X
Date Created: Feb 24, 2018 Date Created: Feb 24, 2018
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Description: This class handles all FFMPEG related Description: This class handles all FFMPEG related
operations. operations.
@ -74,7 +74,7 @@ class Ffmpeg:
Arguments: Arguments:
input_video {string} -- input video path input_video {string} -- input video path
extracted_frames {string} -- video output folder extracted_frames {string} -- video output directory
""" """
execute = [ execute = [
self.ffmpeg_binary, self.ffmpeg_binary,
@ -93,7 +93,7 @@ class Ffmpeg:
Arguments: Arguments:
framerate {float} -- target video framerate framerate {float} -- target video framerate
resolution {string} -- target video resolution resolution {string} -- target video resolution
upscaled_frames {string} -- source images folder upscaled_frames {string} -- source images directory
""" """
execute = [ execute = [
self.ffmpeg_binary, self.ffmpeg_binary,

View File

@ -5,7 +5,7 @@ Name: Video2X Image Cleaner
Author: BrianPetkovsek Author: BrianPetkovsek
Author: K4YT3X Author: K4YT3X
Date Created: March 24, 2019 Date Created: March 24, 2019
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Description: This class is to remove the extracted frames Description: This class is to remove the extracted frames
that have already been upscaled. that have already been upscaled.
@ -27,11 +27,11 @@ class ImageCleaner(threading.Thread):
threading.Thread threading.Thread
""" """
def __init__(self, input_folder, output_folder, num_threads): def __init__(self, input_directory, output_directory, threads):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.input_folder = input_folder self.input_directory = input_directory
self.output_folder = output_folder self.output_directory = output_directory
self.num_threads = num_threads self.threads = threads
self.running = False self.running = False
def run(self): def run(self):
@ -53,23 +53,23 @@ class ImageCleaner(threading.Thread):
""" remove frames that have already been upscaled """ remove frames that have already been upscaled
This method compares the files in the extracted frames This method compares the files in the extracted frames
folder with the upscaled frames folder, and removes directory with the upscaled frames directory, and removes
the frames that has already been upscaled. the frames that has already been upscaled.
""" """
# list all images in the extracted frames # list all images in the extracted frames
output_frames = [f for f in os.listdir(self.output_folder) if os.path.isfile(os.path.join(self.output_folder, f))] output_frames = [f for f in os.listdir(self.output_directory) if os.path.isfile(os.path.join(self.output_directory, f))]
# compare and remove frames downscaled images that finished being upscaled # compare and remove frames downscaled images that finished being upscaled
# within each thread's extracted frames folder # within each thread's extracted frames directory
for i in range(self.num_threads): for i in range(self.threads):
dir_path = os.path.join(self.input_folder, str(i)) dir_path = os.path.join(self.input_directory, str(i))
# for each file within all the folders # for each file within all the directories
for f in os.listdir(dir_path): for f in os.listdir(dir_path):
file_path = os.path.join(dir_path, f) file_path = os.path.join(dir_path, f)
# if file also exists in the output folder, then the file # if file also exists in the output directory, then the file
# has already been processed, thus not needed anymore # has already been processed, thus not needed anymore
if os.path.isfile(file_path) and f in output_frames: if os.path.isfile(file_path) and f in output_frames:
os.remove(file_path) os.remove(file_path)

View File

@ -4,7 +4,7 @@
Name: Video2X Upscaler Name: Video2X Upscaler
Author: K4YT3X Author: K4YT3X
Date Created: December 10, 2018 Date Created: December 10, 2018
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3), Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt available at: https://www.gnu.org/licenses/gpl-3.0.txt
@ -30,7 +30,7 @@ import time
class Upscaler: class Upscaler:
""" An instance of this class is a upscaler that will """ An instance of this class is a upscaler that will
upscale all images in the given folder. upscale all images in the given directory.
Raises: Raises:
Exception -- all exceptions Exception -- all exceptions
@ -52,19 +52,19 @@ class Upscaler:
self.scale_ratio = None self.scale_ratio = None
self.model_dir = None self.model_dir = None
self.threads = 5 self.threads = 5
self.video2x_cache_folder = f'{tempfile.gettempdir()}\\video2x' self.video2x_cache_directory = f'{tempfile.gettempdir()}\\video2x'
self.image_format = 'png' self.image_format = 'png'
self.preserve_frames = False self.preserve_frames = False
def create_temp_folders(self): def create_temp_directories(self):
"""create temporary folder/directories """create temporary directory
""" """
self.extracted_frames = tempfile.mkdtemp(dir=self.video2x_cache_folder) self.extracted_frames = tempfile.mkdtemp(dir=self.video2x_cache_directory)
Avalon.debug_info(f'Extracted frames are being saved to: {self.extracted_frames}') Avalon.debug_info(f'Extracted frames are being saved to: {self.extracted_frames}')
self.upscaled_frames = tempfile.mkdtemp(dir=self.video2x_cache_folder) self.upscaled_frames = tempfile.mkdtemp(dir=self.video2x_cache_directory)
Avalon.debug_info(f'Upscaled frames are being saved to: {self.upscaled_frames}') Avalon.debug_info(f'Upscaled frames are being saved to: {self.upscaled_frames}')
def cleanup(self): def cleanup_temp_directories(self):
"""delete temp directories when done """delete temp directories when done
""" """
if not self.preserve_frames: if not self.preserve_frames:
@ -89,18 +89,18 @@ class Upscaler:
elif not self.method: elif not self.method:
raise ArgumentError('You need to specify the enlarging processing unit') raise ArgumentError('You need to specify the enlarging processing unit')
def _progress_bar(self, extracted_frames_folders): def _progress_bar(self, extracted_frames_directories):
""" This method prints a progress bar """ This method prints a progress bar
This method prints a progress bar by keeping track This method prints a progress bar by keeping track
of the amount of frames in the input directory/folder of the amount of frames in the input directory
and the output directory/folder. This is originally and the output directory. This is originally
suggested by @ArmandBernard. suggested by @ArmandBernard.
""" """
# get number of extracted frames # get number of extracted frames
total_frames = 0 total_frames = 0
for folder in extracted_frames_folders: for directory in extracted_frames_directories:
total_frames += len([f for f in os.listdir(folder) if f[-4:] == '.png']) total_frames += len([f for f in os.listdir(directory) if f[-4:] == '.png'])
with tqdm(total=total_frames, ascii=True, desc='Upscaling Progress') as progress_bar: with tqdm(total=total_frames, ascii=True, desc='Upscaling Progress') as progress_bar:
@ -170,25 +170,25 @@ class Upscaler:
if len(frames) < self.threads: if len(frames) < self.threads:
self.threads = len(frames) self.threads = len(frames)
# create a folder for each thread and append folder # create a directory for each thread and append directory
# name into a list # name into a list
thread_pool = [] thread_pool = []
thread_folders = [] thread_directories = []
for thread_id in range(self.threads): for thread_id in range(self.threads):
thread_folder = f'{self.extracted_frames}\\{str(thread_id)}' thread_directory = f'{self.extracted_frames}\\{str(thread_id)}'
thread_folders.append(thread_folder) thread_directories.append(thread_directory)
# delete old folders and create new folders # delete old directories and create new directories
if os.path.isdir(thread_folder): if os.path.isdir(thread_directory):
shutil.rmtree(thread_folder) shutil.rmtree(thread_directory)
os.mkdir(thread_folder) os.mkdir(thread_directory)
# append folder path into list # append directory path into list
thread_pool.append((thread_folder, thread_id)) thread_pool.append((thread_directory, thread_id))
# evenly distribute images into each folder # evenly distribute images into each directory
# until there is none left in the folder # until there is none left in the directory
for image in frames: for image in frames:
# move image # move image
shutil.move(image, thread_pool[0][0]) shutil.move(image, thread_pool[0][0])
@ -208,7 +208,7 @@ class Upscaler:
upscaler_threads.append(thread) upscaler_threads.append(thread)
# start progress bar in a different thread # start progress bar in a different thread
progress_bar = threading.Thread(target=self._progress_bar, args=(thread_folders,)) progress_bar = threading.Thread(target=self._progress_bar, args=(thread_directories,))
progress_bar.start() progress_bar.start()
# create the clearer and start it # create the clearer and start it

View File

@ -62,12 +62,13 @@
"-map": "1?", "-map": "1?",
"-c": "copy", "-c": "copy",
"-map": "-1:v?", "-map": "-1:v?",
"-pix_fmt": "yuv420p",
"-hwaccel": "auto", "-hwaccel": "auto",
"-y": true "-y": true
} }
}, },
"video2x": { "video2x": {
"video2x_cache_folder": null, "video2x_cache_directory": null,
"image_format": "png", "image_format": "png",
"preserve_frames": false "preserve_frames": false
} }

View File

@ -13,7 +13,7 @@ __ __ _ _ ___ __ __
Name: Video2X Controller Name: Video2X Controller
Author: K4YT3X Author: K4YT3X
Date Created: Feb 24, 2018 Date Created: Feb 24, 2018
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3), Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt available at: https://www.gnu.org/licenses/gpl-3.0.txt
@ -78,7 +78,7 @@ def process_arguments():
upscaler_options = parser.add_argument_group('Upscaler Options') upscaler_options = parser.add_argument_group('Upscaler Options')
upscaler_options.add_argument('-m', '--method', help='Upscaling method', action='store', default='gpu', choices=['cpu', 'gpu', 'cudnn'], required=True) upscaler_options.add_argument('-m', '--method', help='Upscaling method', action='store', default='gpu', choices=['cpu', 'gpu', 'cudnn'], required=True)
upscaler_options.add_argument('-d', '--driver', help='Waifu2x driver', action='store', default='waifu2x_caffe', choices=['waifu2x_caffe', 'waifu2x_converter']) upscaler_options.add_argument('-d', '--driver', help='Waifu2x driver', action='store', default='waifu2x_caffe', choices=['waifu2x_caffe', 'waifu2x_converter'])
upscaler_options.add_argument('-y', '--model_dir', help='Folder containing model JSON files', action='store') upscaler_options.add_argument('-y', '--model_dir', help='directory containing model JSON files', action='store')
upscaler_options.add_argument('-t', '--threads', help='Number of threads to use for upscaling', action='store', type=int, default=5) upscaler_options.add_argument('-t', '--threads', help='Number of threads to use for upscaling', action='store', type=int, default=5)
upscaler_options.add_argument('-c', '--config', help='Video2X config file location', action='store', default=f'{os.path.dirname(os.path.abspath(sys.argv[0]))}\\video2x.json') upscaler_options.add_argument('-c', '--config', help='Video2X config file location', action='store', default=f'{os.path.dirname(os.path.abspath(sys.argv[0]))}\\video2x.json')
upscaler_options.add_argument('-b', '--batch', help='Enable batch mode (select all default values to questions)', action='store_true') upscaler_options.add_argument('-b', '--batch', help='Enable batch mode (select all default values to questions)', action='store_true')
@ -183,24 +183,24 @@ def absolutify_paths(config):
Returns: Returns:
dict -- configuration file dictionary dict -- configuration file dictionary
""" """
current_folder = os.path.dirname(os.path.abspath(sys.argv[0])) current_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
# check waifu2x-caffe path # check waifu2x-caffe path
if not re.match('^[a-z]:', config['waifu2x_caffe']['waifu2x_caffe_path'], re.IGNORECASE): if not re.match('^[a-z]:', config['waifu2x_caffe']['waifu2x_caffe_path'], re.IGNORECASE):
config['waifu2x_caffe']['waifu2x_caffe_path'] = f'{current_folder}\\{config["waifu2x_caffe"]["waifu2x_caffe_path"]}' config['waifu2x_caffe']['waifu2x_caffe_path'] = f'{current_directory}\\{config["waifu2x_caffe"]["waifu2x_caffe_path"]}'
# check waifu2x-converter-cpp path # check waifu2x-converter-cpp path
if not re.match('^[a-z]:', config['waifu2x_converter']['waifu2x_converter_path'], re.IGNORECASE): if not re.match('^[a-z]:', config['waifu2x_converter']['waifu2x_converter_path'], re.IGNORECASE):
config['waifu2x_converter']['waifu2x_converter_path'] = f'{current_folder}\\{config["waifu2x_converter"]["waifu2x_converter_path"]}' config['waifu2x_converter']['waifu2x_converter_path'] = f'{current_directory}\\{config["waifu2x_converter"]["waifu2x_converter_path"]}'
# check ffmpeg path # check ffmpeg path
if not re.match('^[a-z]:', config['ffmpeg']['ffmpeg_path'], re.IGNORECASE): if not re.match('^[a-z]:', config['ffmpeg']['ffmpeg_path'], re.IGNORECASE):
config['ffmpeg']['ffmpeg_path'] = f'{current_folder}\\{config["ffmpeg"]["ffmpeg_path"]}' config['ffmpeg']['ffmpeg_path'] = f'{current_directory}\\{config["ffmpeg"]["ffmpeg_path"]}'
# check video2x cache path # check video2x cache path
if config['video2x']['video2x_cache_folder']: if config['video2x']['video2x_cache_directory']:
if not re.match('^[a-z]:', config['video2x']['video2x_cache_folder'], re.IGNORECASE): if not re.match('^[a-z]:', config['video2x']['video2x_cache_directory'], re.IGNORECASE):
config['video2x']['video2x_cache_folder'] = f'{current_folder}\\{config["video2x"]["video2x_cache_folder"]}' config['video2x']['video2x_cache_directory'] = f'{current_directory}\\{config["video2x"]["video2x_cache_directory"]}'
return config return config
@ -256,26 +256,26 @@ elif args.driver == 'waifu2x_converter':
ffmpeg_settings = config['ffmpeg'] ffmpeg_settings = config['ffmpeg']
# load video2x settings # load video2x settings
video2x_cache_folder = config['video2x']['video2x_cache_folder'] video2x_cache_directory = config['video2x']['video2x_cache_directory']
image_format = config['video2x']['image_format'].lower() image_format = config['video2x']['image_format'].lower()
preserve_frames = config['video2x']['preserve_frames'] preserve_frames = config['video2x']['preserve_frames']
# create temp directories if they don't exist # create temp directories if they don't exist
if not video2x_cache_folder: if not video2x_cache_directory:
video2x_cache_folder = f'{tempfile.gettempdir()}\\video2x' video2x_cache_directory = f'{tempfile.gettempdir()}\\video2x'
if video2x_cache_folder and not os.path.isdir(video2x_cache_folder): if video2x_cache_directory and not os.path.isdir(video2x_cache_directory):
if not os.path.isfile(video2x_cache_folder) and not os.path.islink(video2x_cache_folder): if not os.path.isfile(video2x_cache_directory) and not os.path.islink(video2x_cache_directory):
Avalon.warning(f'Specified cache folder/directory {video2x_cache_folder} does not exist') Avalon.warning(f'Specified cache directory {video2x_cache_directory} does not exist')
if Avalon.ask('Create folder/directory?', default=True, batch=args.batch): if Avalon.ask('Create directory?', default=True, batch=args.batch):
if os.mkdir(video2x_cache_folder) is None: if os.mkdir(video2x_cache_directory) is None:
Avalon.info(f'{video2x_cache_folder} created') Avalon.info(f'{video2x_cache_directory} created')
else: else:
Avalon.error(f'Unable to create {video2x_cache_folder}') Avalon.error(f'Unable to create {video2x_cache_directory}')
Avalon.error('Aborting...') Avalon.error('Aborting...')
exit(1) exit(1)
else: else:
Avalon.error('Specified cache folder/directory is a file/link') Avalon.error('Specified cache directory is a file/link')
Avalon.error('Unable to continue, exiting...') Avalon.error('Unable to continue, exiting...')
exit(1) exit(1)
@ -293,7 +293,7 @@ try:
# check for input output format mismatch # check for input output format mismatch
if os.path.isdir(args.output): if os.path.isdir(args.output):
Avalon.error('Input and output path type mismatch') Avalon.error('Input and output path type mismatch')
Avalon.error('Input is single file but output is folder') Avalon.error('Input is single file but output is directory')
raise Exception('input output path type mismatch') raise Exception('input output path type mismatch')
if not re.search('.*\..*$', args.output): if not re.search('.*\..*$', args.output):
Avalon.error('No suffix found in output file path') Avalon.error('No suffix found in output file path')
@ -309,19 +309,19 @@ try:
upscaler.scale_ratio = args.ratio upscaler.scale_ratio = args.ratio
upscaler.model_dir = args.model_dir upscaler.model_dir = args.model_dir
upscaler.threads = args.threads upscaler.threads = args.threads
upscaler.video2x_cache_folder = video2x_cache_folder upscaler.video2x_cache_directory = video2x_cache_directory
upscaler.image_format = image_format upscaler.image_format = image_format
upscaler.preserve_frames = preserve_frames upscaler.preserve_frames = preserve_frames
# run upscaler # run upscaler
upscaler.create_temp_folders() upscaler.create_temp_directories()
upscaler.run() upscaler.run()
upscaler.cleanup() upscaler.cleanup_temp_directories()
# if input specified is a folder # if input specified is a directory
elif os.path.isdir(args.input): elif os.path.isdir(args.input):
""" Upscale videos in a folder/directory """ """ Upscale videos in a directory """
Avalon.info(f'Upscaling videos in folder/directory: {args.input}') Avalon.info(f'Upscaling videos in directory: {args.input}')
for input_video in [f for f in os.listdir(args.input) if os.path.isfile(os.path.join(args.input, f))]: for input_video in [f for f in os.listdir(args.input) if os.path.isfile(os.path.join(args.input, f))]:
output_video = f'{args.output}\\{input_video}' output_video = f'{args.output}\\{input_video}'
upscaler = Upscaler(input_video=os.path.join(args.input, input_video), output_video=output_video, method=args.method, waifu2x_settings=waifu2x_settings, ffmpeg_settings=ffmpeg_settings) upscaler = Upscaler(input_video=os.path.join(args.input, input_video), output_video=output_video, method=args.method, waifu2x_settings=waifu2x_settings, ffmpeg_settings=ffmpeg_settings)
@ -333,26 +333,26 @@ try:
upscaler.scale_ratio = args.ratio upscaler.scale_ratio = args.ratio
upscaler.model_dir = args.model_dir upscaler.model_dir = args.model_dir
upscaler.threads = args.threads upscaler.threads = args.threads
upscaler.video2x_cache_folder = video2x_cache_folder upscaler.video2x_cache_directory = video2x_cache_directory
upscaler.image_format = image_format upscaler.image_format = image_format
upscaler.preserve_frames = preserve_frames upscaler.preserve_frames = preserve_frames
# run upscaler # run upscaler
upscaler.create_temp_folders() upscaler.create_temp_directories()
upscaler.run() upscaler.run()
upscaler.cleanup() upscaler.cleanup_temp_directories()
else: else:
Avalon.error('Input path is neither a file nor a folder/directory') Avalon.error('Input path is neither a file nor a directory')
raise FileNotFoundError(f'{args.input} is neither file nor folder/directory') raise FileNotFoundError(f'{args.input} is neither file nor directory')
Avalon.info(f'Program completed, taking {round((time.time() - begin_time), 5)} seconds') Avalon.info(f'Program completed, taking {round((time.time() - begin_time), 5)} seconds')
except Exception: except Exception:
Avalon.error('An exception has occurred') Avalon.error('An exception has occurred')
traceback.print_exc() traceback.print_exc()
finally: finally:
# remove Video2X Cache folder # remove Video2X Cache directory
try: try:
if not preserve_frames: if not preserve_frames:
shutil.rmtree(video2x_cache_folder) shutil.rmtree(video2x_cache_directory)
except FileNotFoundError: except FileNotFoundError:
pass pass

View File

@ -4,7 +4,7 @@
Name: Video2X Setup Script Name: Video2X Setup Script
Author: K4YT3X Author: K4YT3X
Date Created: November 28, 2018 Date Created: November 28, 2018
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3), Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt available at: https://www.gnu.org/licenses/gpl-3.0.txt
@ -167,9 +167,7 @@ class Video2xSetup:
template_dict['waifu2x_converter']['waifu2x_converter_path'] = f'{local_app_data}\\video2x\\waifu2x-converter-cpp' template_dict['waifu2x_converter']['waifu2x_converter_path'] = f'{local_app_data}\\video2x\\waifu2x-converter-cpp'
template_dict['ffmpeg']['ffmpeg_path'] = f'{local_app_data}\\video2x\\ffmpeg-latest-win64-static\\bin' template_dict['ffmpeg']['ffmpeg_path'] = f'{local_app_data}\\video2x\\ffmpeg-latest-win64-static\\bin'
template_dict['ffmpeg']['ffmpeg_hwaccel'] = 'auto' template_dict['video2x']['video2x_cache_directory'] = None
template_dict['ffmpeg']['extra_arguments'] = []
template_dict['video2x']['video2x_cache_folder'] = None
template_dict['video2x']['preserve_frames'] = False template_dict['video2x']['preserve_frames'] = False
# Write configuration into file # Write configuration into file

View File

@ -4,7 +4,7 @@
Name: Waifu2x Caffe Driver Name: Waifu2x Caffe Driver
Author: K4YT3X Author: K4YT3X
Date Created: Feb 24, 2018 Date Created: Feb 24, 2018
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Description: This class is a high-level wrapper Description: This class is a high-level wrapper
for waifu2x-caffe. for waifu2x-caffe.
@ -33,20 +33,20 @@ class Waifu2xCaffe:
self.model_dir = model_dir self.model_dir = model_dir
self.print_lock = threading.Lock() self.print_lock = threading.Lock()
def upscale(self, input_folder, output_folder, scale_ratio, scale_width, scale_height, image_format, upscaler_exceptions): def upscale(self, input_directory, output_directory, scale_ratio, scale_width, scale_height, image_format, upscaler_exceptions):
"""This is the core function for WAIFU2X class """This is the core function for WAIFU2X class
Arguments: Arguments:
input_folder {string} -- source folder path input_directory {string} -- source directory path
output_folder {string} -- output folder path output_directory {string} -- output directory path
width {int} -- output video width width {int} -- output video width
height {int} -- output video height height {int} -- output video height
""" """
try: try:
# overwrite config file settings # overwrite config file settings
self.waifu2x_settings['input_path'] = input_folder self.waifu2x_settings['input_path'] = input_directory
self.waifu2x_settings['output_path'] = output_folder self.waifu2x_settings['output_path'] = output_directory
if scale_ratio: if scale_ratio:
self.waifu2x_settings['scale_ratio'] = scale_ratio self.waifu2x_settings['scale_ratio'] = scale_ratio

View File

@ -4,7 +4,7 @@
Name: Waifu2x Converter CPP Driver Name: Waifu2x Converter CPP Driver
Author: K4YT3X Author: K4YT3X
Date Created: February 8, 2019 Date Created: February 8, 2019
Last Modified: April 21, 2019 Last Modified: April 28, 2019
Description: This class is a high-level wrapper Description: This class is a high-level wrapper
for waifu2x-converter-cpp. for waifu2x-converter-cpp.
@ -28,26 +28,26 @@ class Waifu2xConverter:
self.waifu2x_settings['model_dir'] = model_dir self.waifu2x_settings['model_dir'] = model_dir
self.print_lock = threading.Lock() self.print_lock = threading.Lock()
def upscale(self, input_folder, output_folder, scale_ratio, jobs, image_format, upscaler_exceptions): def upscale(self, input_directory, output_directory, scale_ratio, jobs, image_format, upscaler_exceptions):
""" Waifu2x Converter Driver Upscaler """ Waifu2x Converter Driver Upscaler
This method executes the upscaling of extracted frames. This method executes the upscaling of extracted frames.
Arguments: Arguments:
input_folder {string} -- source folder path input_directory {string} -- source directory path
output_folder {string} -- output folder path output_directory {string} -- output directory path
scale_ratio {int} -- frames' scale ratio scale_ratio {int} -- frames' scale ratio
threads {int} -- number of threads threads {int} -- number of threads
""" """
try: try:
# overwrite config file settings # overwrite config file settings
self.waifu2x_settings['input'] = input_folder self.waifu2x_settings['input'] = input_directory
self.waifu2x_settings['output'] = output_folder self.waifu2x_settings['output'] = output_directory
# temporary fix for https://github.com/DeadSix27/waifu2x-converter-cpp/issues/109 # temporary fix for https://github.com/DeadSix27/waifu2x-converter-cpp/issues/109
""" """
self.waifu2x_settings['i'] = input_folder self.waifu2x_settings['i'] = input_directory
self.waifu2x_settings['o'] = output_folder self.waifu2x_settings['o'] = output_directory
self.waifu2x_settings['input'] = None self.waifu2x_settings['input'] = None
self.waifu2x_settings['output'] = None self.waifu2x_settings['output'] = None
""" """