diff --git a/src/ffmpeg.py b/src/wrappers/ffmpeg.py old mode 100755 new mode 100644 similarity index 100% rename from src/ffmpeg.py rename to src/wrappers/ffmpeg.py diff --git a/src/srmd_ncnn_vulkan.py b/src/wrappers/srmd_ncnn_vulkan.py similarity index 100% rename from src/srmd_ncnn_vulkan.py rename to src/wrappers/srmd_ncnn_vulkan.py diff --git a/src/waifu2x_caffe.py b/src/wrappers/waifu2x_caffe.py old mode 100755 new mode 100644 similarity index 88% rename from src/waifu2x_caffe.py rename to src/wrappers/waifu2x_caffe.py index cb8cd97..147abfb --- a/src/waifu2x_caffe.py +++ b/src/wrappers/waifu2x_caffe.py @@ -4,7 +4,7 @@ Name: Waifu2x Caffe Driver Author: K4YT3X Date Created: Feb 24, 2018 -Last Modified: February 22, 2020 +Last Modified: May 3, 2020 Description: This class is a high-level wrapper for waifu2x-caffe. @@ -29,14 +29,12 @@ class Waifu2xCaffe: the upscale function. """ - def __init__(self, driver_settings, process, model_dir, bit_depth): + def __init__(self, driver_settings, model_dir, bit_depth): self.driver_settings = driver_settings - self.driver_settings['process'] = process self.driver_settings['model_dir'] = model_dir self.driver_settings['output_depth'] = bit_depth # arguments passed through command line overwrites config file values - self.process = process self.model_dir = model_dir self.print_lock = threading.Lock() @@ -64,21 +62,24 @@ class Waifu2xCaffe: # list to be executed # initialize the list with waifu2x binary path as the first element - execute = [str(self.driver_settings['path'])] + execute = [self.driver_settings.pop('path')] for key in self.driver_settings.keys(): value = self.driver_settings[key] # is executable key or null or None means that leave this option out (keep default) - if key == 'path' or value is None or value is False: + if value is None or value is False: continue else: if len(key) == 1: execute.append(f'-{key}') else: execute.append(f'--{key}') - execute.append(str(value)) + + # true means key is an option + if value is not True: + execute.append(str(value)) # return the Popen object of the new process created self.print_lock.acquire() diff --git a/src/waifu2x_converter.py b/src/wrappers/waifu2x_converter_cpp.py old mode 100755 new mode 100644 similarity index 85% rename from src/waifu2x_converter.py rename to src/wrappers/waifu2x_converter_cpp.py index e1d224a..f4b97e6 --- a/src/waifu2x_converter.py +++ b/src/wrappers/waifu2x_converter_cpp.py @@ -4,7 +4,7 @@ Name: Waifu2x Converter CPP Driver Author: K4YT3X Date Created: February 8, 2019 -Last Modified: February 22, 2020 +Last Modified: May 3, 2020 Description: This class is a high-level wrapper for waifu2x-converter-cpp. @@ -21,7 +21,7 @@ import threading from avalon_framework import Avalon -class Waifu2xConverter: +class Waifu2xConverterCpp: """This class communicates with waifu2x cui engine An object will be created for this class, containing information @@ -56,22 +56,18 @@ class Waifu2xConverter: # models_rgb must be specified manually for waifu2x-converter-cpp # if it's not specified in the arguments, create automatically if self.driver_settings['model-dir'] is None: - self.driver_settings['model-dir'] = pathlib.Path(self.driver_settings['path']) / 'models_rgb' + self.driver_settings['model-dir'] = pathlib.Path(self.driver_settings['path']).parent / 'models_rgb' # list to be executed # initialize the list with waifu2x binary path as the first element - execute = [str(pathlib.Path(self.driver_settings['path']) / 'waifu2x-converter-cpp.exe')] + execute = [self.driver_settings.pop('path')] for key in self.driver_settings.keys(): value = self.driver_settings[key] - # the key doesn't need to be passed in this case - if key == 'path': - continue - # null or None means that leave this option out (keep default) - elif value is None or value is False: + if value is None or value is False: continue else: if len(key) == 1: @@ -80,10 +76,8 @@ class Waifu2xConverter: execute.append(f'--{key}') # true means key is an option - if value is True: - continue - - execute.append(str(value)) + if value is not True: + execute.append(str(value)) # return the Popen object of the new process created self.print_lock.acquire() diff --git a/src/waifu2x_ncnn_vulkan.py b/src/wrappers/waifu2x_ncnn_vulkan.py old mode 100755 new mode 100644 similarity index 100% rename from src/waifu2x_ncnn_vulkan.py rename to src/wrappers/waifu2x_ncnn_vulkan.py