mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-02-27 10:44:47 +08:00
better exception handling, soft task interruption, GUI stop button, GUI folder processing, better argument checks
This commit is contained in:
@@ -13,6 +13,8 @@ for waifu2x-caffe.
|
||||
# built-in imports
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import platform
|
||||
import shlex
|
||||
import subprocess
|
||||
import threading
|
||||
@@ -32,6 +34,7 @@ class WrapperMain:
|
||||
@staticmethod
|
||||
def parse_arguments(arguments):
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
|
||||
parser.error = lambda message: (_ for _ in ()).throw(AttributeError(message))
|
||||
parser.add_argument('--help', action='help', help='show this help message and exit')
|
||||
# parser.add_argument('-i', '--input', type=pathlib.Path, help='File for loading')
|
||||
# parser.add_argument('-o', '--output', type=pathlib.Path, help='File for outputting')
|
||||
@@ -70,6 +73,11 @@ class WrapperMain:
|
||||
self.driver_settings['output'] = output_file
|
||||
self.driver_settings['zoomFactor'] = zoom_factor
|
||||
self.driver_settings['threads'] = threads
|
||||
|
||||
# Anime4KCPP will look for Anime4KCPPKernel.cl under the current working directory
|
||||
# change the CWD to its containing directory so it will find it
|
||||
if platform.system() == 'Windows':
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# list to be executed
|
||||
# initialize the list with waifu2x binary path as the first element
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: Video2X FFmpeg Controller
|
||||
Author: K4YT3X
|
||||
Date Created: Feb 24, 2018
|
||||
Last Modified: November 15, 2019
|
||||
Last Modified: May 7, 2020
|
||||
|
||||
Description: This class handles all FFmpeg related operations.
|
||||
"""
|
||||
@@ -131,7 +131,7 @@ class Ffmpeg:
|
||||
extracted_frames / f'extracted_%0d.{self.image_format}'
|
||||
])
|
||||
|
||||
self._execute(execute)
|
||||
return(self._execute(execute))
|
||||
|
||||
def convert_video(self, framerate, resolution, upscaled_frames):
|
||||
"""Converts images into videos
|
||||
@@ -180,7 +180,7 @@ class Ffmpeg:
|
||||
upscaled_frames / 'no_audio.mp4'
|
||||
])
|
||||
|
||||
self._execute(execute)
|
||||
return(self._execute(execute))
|
||||
|
||||
def migrate_audio_tracks_subtitles(self, input_video, output_video, upscaled_frames):
|
||||
""" Migrates audio tracks and subtitles from input video to output video
|
||||
@@ -209,7 +209,7 @@ class Ffmpeg:
|
||||
output_video
|
||||
])
|
||||
|
||||
self._execute(execute)
|
||||
return(self._execute(execute))
|
||||
|
||||
def _read_configuration(self, phase, section=None):
|
||||
""" read configuration from JSON
|
||||
@@ -284,4 +284,4 @@ class Ffmpeg:
|
||||
|
||||
Avalon.debug_info(f'Executing: {execute}')
|
||||
|
||||
return subprocess.run(execute, check=True).returncode
|
||||
return subprocess.Popen(execute)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: SRMD NCNN Vulkan Driver
|
||||
Creator: K4YT3X
|
||||
Date Created: April 26, 2020
|
||||
Last Modified: May 5, 2020
|
||||
Last Modified: May 7, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for srmd_ncnn_vulkan.
|
||||
@@ -39,6 +39,7 @@ class WrapperMain:
|
||||
@staticmethod
|
||||
def parse_arguments(arguments):
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
|
||||
parser.error = lambda message: (_ for _ in ()).throw(AttributeError(message))
|
||||
parser.add_argument('--help', action='help', help='show this help message and exit')
|
||||
parser.add_argument('-v', action='store_true', help='verbose output')
|
||||
# parser.add_argument('-i', type=pathlib.Path, help='input image path (jpg/png) or directory')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: Waifu2x Caffe Driver
|
||||
Author: K4YT3X
|
||||
Date Created: Feb 24, 2018
|
||||
Last Modified: May 4, 2020
|
||||
Last Modified: May 7, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-caffe.
|
||||
@@ -37,6 +37,7 @@ class WrapperMain:
|
||||
@staticmethod
|
||||
def parse_arguments(arguments):
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
|
||||
parser.error = lambda message: (_ for _ in ()).throw(AttributeError(message))
|
||||
parser.add_argument('--help', action='help', help='show this help message and exit')
|
||||
parser.add_argument('-t', '--tta', type=int, choices=range(2), help='8x slower and slightly high quality')
|
||||
parser.add_argument('--gpu', type=int, help='gpu device no')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: Waifu2x Converter CPP Driver
|
||||
Author: K4YT3X
|
||||
Date Created: February 8, 2019
|
||||
Last Modified: May 4, 2020
|
||||
Last Modified: May 7, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-converter-cpp.
|
||||
@@ -38,6 +38,7 @@ class WrapperMain:
|
||||
@staticmethod
|
||||
def parse_arguments(arguments):
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
|
||||
parser.error = lambda message: (_ for _ in ()).throw(AttributeError(message))
|
||||
parser.add_argument('--help', action='help', help='show this help message and exit')
|
||||
parser.add_argument('--list-supported-formats', action='store_true', help='dump currently supported format list')
|
||||
parser.add_argument('--list-opencv-formats', action='store_true', help='(deprecated. Use --list-supported-formats) dump opencv supported format list')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: Waifu2x NCNN Vulkan Driver
|
||||
Creator: SAT3LL
|
||||
Date Created: June 26, 2019
|
||||
Last Modified: May 5, 2020
|
||||
Last Modified: May 7, 2020
|
||||
|
||||
Editor: K4YT3X
|
||||
Last Modified: February 22, 2020
|
||||
@@ -42,6 +42,7 @@ class WrapperMain:
|
||||
@staticmethod
|
||||
def parse_arguments(arguments):
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
|
||||
parser.error = lambda message: (_ for _ in ()).throw(AttributeError(message))
|
||||
parser.add_argument('--help', action='help', help='show this help message and exit')
|
||||
parser.add_argument('-v', action='store_true', help='verbose output')
|
||||
# parser.add_argument('-i', type=pathlib.Path, help='input image path (jpg/png) or directory')
|
||||
|
||||
Reference in New Issue
Block a user