updated setup script for RealSR NCNN Vulkan and changed requirement files

This commit is contained in:
k4yt3x 2020-05-29 16:02:06 -04:00
parent 41833f4068
commit a41df138bf

View File

@ -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
"""