diff --git a/src/upscaler.py b/src/upscaler.py index 0bb07c6..3d741b5 100755 --- a/src/upscaler.py +++ b/src/upscaler.py @@ -4,7 +4,7 @@ Name: Video2X Upscaler Author: K4YT3X Date Created: December 10, 2018 -Last Modified: June 7, 2020 +Last Modified: June 8, 2020 Description: This file contains the Upscaler class. Each instance of the Upscaler class is an upscaler on an image or @@ -50,7 +50,7 @@ language.install() _ = language.gettext # version information -UPSCALER_VERSION = '4.2.1' +UPSCALER_VERSION = '4.2.2' # these names are consistent for # - driver selection in command line @@ -73,23 +73,39 @@ class Upscaler: ArgumentError -- if argument is not valid """ - def __init__(self, input_path, output_path, driver_settings, ffmpeg_settings, gifski_settings): - # mandatory arguments + def __init__( + self, + input_path: pathlib.Path or list, + output_path: pathlib.Path, + driver_settings: dict, + ffmpeg_settings: dict, + gifski_settings: dict, + driver: str = 'waifu2x_caffe', + scale_ratio: float = None, + processes: int = 1, + video2x_cache_directory: pathlib.Path = pathlib.Path(tempfile.gettempdir()) / 'video2x', + extracted_frame_format: str = 'png', + image_output_extension: str = '.png', + video_output_extension: str = '.mp4', + preserve_frames: bool = False + ): + + # required parameters self.input = input_path self.output = output_path self.driver_settings = driver_settings self.ffmpeg_settings = ffmpeg_settings self.gifski_settings = gifski_settings - # optional arguments - self.driver = 'waifu2x_caffe' - self.scale_ratio = None - self.processes = 1 - self.video2x_cache_directory = pathlib.Path(tempfile.gettempdir()) / 'video2x' - self.extracted_frame_format = 'png' - self.image_output_extension = '.png' - self.video_output_extension = '.mp4' - self.preserve_frames = False + # optional parameters + self.driver = driver + self.scale_ratio = scale_ratio + self.processes = processes + self.video2x_cache_directory = video2x_cache_directory + self.extracted_frame_format = extracted_frame_format + self.image_output_extension = image_output_extension + self.video_output_extension = video_output_extension + self.preserve_frames = preserve_frames # other internal members and signals self.running = False diff --git a/src/video2x.py b/src/video2x.py index 3ceec07..dbda134 100755 --- a/src/video2x.py +++ b/src/video2x.py @@ -13,7 +13,7 @@ __ __ _ _ ___ __ __ Name: Video2X Controller Creator: K4YT3X Date Created: Feb 24, 2018 -Last Modified: June 7, 2020 +Last Modified: June 8, 2020 Editor: BrianPetkovsek Last Modified: June 17, 2019 @@ -81,7 +81,7 @@ language = gettext.translation(DOMAIN, LOCALE_DIRECTORY, [default_locale], fallb language.install() _ = language.gettext -CLI_VERSION = '4.1.0' +CLI_VERSION = '4.1.1' LEGAL_INFO = _('''Video2X CLI Version: {} Upscaler Version: {} @@ -236,21 +236,24 @@ try: begin_time = time.time() # initialize upscaler object - upscaler = Upscaler(input_path=video2x_args.input, - output_path=video2x_args.output, - driver_settings=driver_settings, - ffmpeg_settings=ffmpeg_settings, - gifski_settings=gifski_settings) + upscaler = Upscaler( + # required parameters + input_path=video2x_args.input, + output_path=video2x_args.output, + driver_settings=driver_settings, + ffmpeg_settings=ffmpeg_settings, + gifski_settings=gifski_settings, - # set upscaler optional options - upscaler.driver = video2x_args.driver - upscaler.scale_ratio = video2x_args.ratio - upscaler.processes = video2x_args.processes - upscaler.video2x_cache_directory = video2x_cache_directory - upscaler.extracted_frame_format = extracted_frame_format - upscaler.image_output_extension = image_output_extension - upscaler.video_output_extension = video_output_extension - upscaler.preserve_frames = preserve_frames + # optional parameters + driver=video2x_args.driver, + scale_ratio=video2x_args.ratio, + processes=video2x_args.processes, + video2x_cache_directory=video2x_cache_directory, + extracted_frame_format=extracted_frame_format, + image_output_extension=image_output_extension, + video_output_extension=video_output_extension, + preserve_frames=preserve_frames + ) # run upscaler upscaler.run() diff --git a/src/video2x_gui.py b/src/video2x_gui.py index ba0983b..d789204 100755 --- a/src/video2x_gui.py +++ b/src/video2x_gui.py @@ -4,7 +4,7 @@ Creator: Video2X GUI Author: K4YT3X Date Created: May 5, 2020 -Last Modified: June 7, 2020 +Last Modified: June 8, 2020 """ # local imports @@ -34,7 +34,7 @@ from PyQt5.QtGui import * from PyQt5.QtWidgets import * import magic -GUI_VERSION = '2.7.0' +GUI_VERSION = '2.7.1' LEGAL_INFO = f'''Video2X GUI Version: {GUI_VERSION}\\ Upscaler Version: {UPSCALER_VERSION}\\ @@ -1173,21 +1173,24 @@ It\'s also highly recommended for you to attach the [log file]({}) under the pro # load driver settings for the current driver self.driver_settings = self.config[AVAILABLE_DRIVERS[self.driver_combo_box.currentText()]] - self.upscaler = Upscaler(input_path=input_directory, - output_path=output_directory, - driver_settings=self.driver_settings, - ffmpeg_settings=self.ffmpeg_settings, - gifski_settings=self.gifski_settings) + self.upscaler = Upscaler( + # required parameters + input_path=input_directory, + output_path=output_directory, + driver_settings=self.driver_settings, + ffmpeg_settings=self.ffmpeg_settings, + gifski_settings=self.gifski_settings, - # set optional options - self.upscaler.driver = AVAILABLE_DRIVERS[self.driver_combo_box.currentText()] - self.upscaler.scale_ratio = self.scale_ratio_double_spin_box.value() - self.upscaler.processes = self.processes_spin_box.value() - self.upscaler.video2x_cache_directory = pathlib.Path(os.path.expandvars(self.cache_line_edit.text())) - self.upscaler.extracted_frame_format = self.config['video2x']['extracted_frame_format'].lower() - self.upscaler.image_output_extension = self.image_output_extension_line_edit.text() - self.upscaler.video_output_extension = self.video_output_extension_line_edit.text() - self.upscaler.preserve_frames = bool(self.preserve_frames_check_box.isChecked()) + # optional parameters + driver=AVAILABLE_DRIVERS[self.driver_combo_box.currentText()], + scale_ratio=self.scale_ratio_double_spin_box.value(), + processes=self.processes_spin_box.value(), + video2x_cache_directory=pathlib.Path(os.path.expandvars(self.cache_line_edit.text())), + extracted_frame_format=self.config['video2x']['extracted_frame_format'].lower(), + image_output_extension=self.image_output_extension_line_edit.text(), + video_output_extension=self.video_output_extension_line_edit.text(), + preserve_frames=bool(self.preserve_frames_check_box.isChecked()) + ) # run upscaler worker = UpscalerWorker(self.upscaler.run) diff --git a/src/video2x_gui.ui b/src/video2x_gui.ui index ccb57b4..2445d14 100644 --- a/src/video2x_gui.ui +++ b/src/video2x_gui.ui @@ -6,8 +6,8 @@ 0 0 - 673 - 910 + 727 + 908 @@ -2835,7 +2835,7 @@ 0 0 - 673 + 727 21