From a41df138bf29543f5012feb76c1504945faa08e7 Mon Sep 17 00:00:00 2001 From: k4yt3x Date: Fri, 29 May 2020 16:02:06 -0400 Subject: [PATCH] updated setup script for RealSR NCNN Vulkan and changed requirement files --- src/video2x_setup.py | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/video2x_setup.py b/src/video2x_setup.py index b0efff3..8fd75d7 100755 --- a/src/video2x_setup.py +++ b/src/video2x_setup.py @@ -4,7 +4,7 @@ Name: Video2X Setup Script Creator: K4YT3X Date Created: November 28, 2018 -Last Modified: May 16, 2020 +Last Modified: May 29, 2020 Editor: BrianPetkovsek Editor: SAT3LL @@ -17,8 +17,9 @@ Installation Details: - waifu2x-caffe: %LOCALAPPDATA%\\video2x\\waifu2x-caffe - waifu2x-cpp-converter: %LOCALAPPDATA%\\video2x\\waifu2x-converter-cpp - waifu2x_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\waifu2x-ncnn-vulkan -- anime4kcpp: %LOCALAPPDATA%\\video2x\\anime4kcpp - srmd_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\srmd-ncnn-vulkan +- realsr_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\realsr-ncnn-vulkan +- anime4kcpp: %LOCALAPPDATA%\\video2x\\anime4kcpp """ # built-in imports @@ -43,7 +44,7 @@ import zipfile # Therefore, they will be installed during the Python dependency # installation step and imported later in the script. -SETUP_VERSION = '2.1.0' +SETUP_VERSION = '2.2.0' # global static variables LOCALAPPDATA = pathlib.Path(os.getenv('localappdata')) @@ -54,8 +55,9 @@ DRIVER_OPTIONS = ['all', 'waifu2x_caffe', 'waifu2x_converter_cpp', 'waifu2x_ncnn_vulkan', - 'anime4kcpp', - 'srmd_ncnn_vulkan'] + 'srmd_ncnn_vulkan', + # 'realsr_ncnn_vulkan', + 'anime4kcpp'] def parse_arguments(): @@ -103,7 +105,7 @@ class Video2xSetup: def _install_python_requirements(self): """ Read requirements.txt and return its content """ - pip_install('requirements.txt') + pip_install('requirements-windows.txt') def _cleanup(self): """ Cleanup all the temp files downloaded @@ -209,6 +211,32 @@ class Video2xSetup: # rename the newly extracted directory (LOCALAPPDATA / 'video2x' / zipf.namelist()[0]).rename(waifu2x_ncnn_vulkan_directory) + def _install_realsr_ncnn_vulkan(self): + """ Install realsr-ncnn-vulkan + """ + print('\nInstalling realsr-ncnn-vulkan') + import requests + + # Get latest release of realsr-ncnn-vulkan via Github API + latest_release = requests.get('https://api.github.com/repos/nihui/realsr-ncnn-vulkan/releases/latest').json() + + for a in latest_release['assets']: + if re.search(r'realsr-ncnn-vulkan-\d*\.zip', a['browser_download_url']): + realsr_ncnn_vulkan_zip = download(a['browser_download_url'], tempfile.gettempdir()) + self.trash.append(realsr_ncnn_vulkan_zip) + + # extract and rename + realsr_ncnn_vulkan_directory = LOCALAPPDATA / 'video2x' / 'realsr-ncnn-vulkan' + with zipfile.ZipFile(realsr_ncnn_vulkan_zip) as zipf: + zipf.extractall(LOCALAPPDATA / 'video2x') + + # if directory already exists, remove it + if realsr_ncnn_vulkan_directory.exists(): + shutil.rmtree(realsr_ncnn_vulkan_directory) + + # rename the newly extracted directory + (LOCALAPPDATA / 'video2x' / zipf.namelist()[0]).rename(realsr_ncnn_vulkan_directory) + def _install_anime4kcpp(self): """ Install Anime4KCPP """