mirror of
				https://github.com/k4yt3x/video2x.git
				synced 2025-11-03 22:21:37 +01:00 
			
		
		
		
	updated setup script for RealSR NCNN Vulkan and changed requirement files
This commit is contained in:
		
							parent
							
								
									41833f4068
								
							
						
					
					
						commit
						a41df138bf
					
				@ -4,7 +4,7 @@
 | 
				
			|||||||
Name: Video2X Setup Script
 | 
					Name: Video2X Setup Script
 | 
				
			||||||
Creator: K4YT3X
 | 
					Creator: K4YT3X
 | 
				
			||||||
Date Created: November 28, 2018
 | 
					Date Created: November 28, 2018
 | 
				
			||||||
Last Modified: May 16, 2020
 | 
					Last Modified: May 29, 2020
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Editor: BrianPetkovsek
 | 
					Editor: BrianPetkovsek
 | 
				
			||||||
Editor: SAT3LL
 | 
					Editor: SAT3LL
 | 
				
			||||||
@ -17,8 +17,9 @@ Installation Details:
 | 
				
			|||||||
- waifu2x-caffe: %LOCALAPPDATA%\\video2x\\waifu2x-caffe
 | 
					- waifu2x-caffe: %LOCALAPPDATA%\\video2x\\waifu2x-caffe
 | 
				
			||||||
- waifu2x-cpp-converter: %LOCALAPPDATA%\\video2x\\waifu2x-converter-cpp
 | 
					- waifu2x-cpp-converter: %LOCALAPPDATA%\\video2x\\waifu2x-converter-cpp
 | 
				
			||||||
- waifu2x_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\waifu2x-ncnn-vulkan
 | 
					- waifu2x_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\waifu2x-ncnn-vulkan
 | 
				
			||||||
- anime4kcpp: %LOCALAPPDATA%\\video2x\\anime4kcpp
 | 
					 | 
				
			||||||
- srmd_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\srmd-ncnn-vulkan
 | 
					- srmd_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\srmd-ncnn-vulkan
 | 
				
			||||||
 | 
					- realsr_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\realsr-ncnn-vulkan
 | 
				
			||||||
 | 
					- anime4kcpp: %LOCALAPPDATA%\\video2x\\anime4kcpp
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# built-in imports
 | 
					# built-in imports
 | 
				
			||||||
@ -43,7 +44,7 @@ import zipfile
 | 
				
			|||||||
# Therefore, they will be installed during the Python dependency
 | 
					# Therefore, they will be installed during the Python dependency
 | 
				
			||||||
#   installation step and imported later in the script.
 | 
					#   installation step and imported later in the script.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SETUP_VERSION = '2.1.0'
 | 
					SETUP_VERSION = '2.2.0'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# global static variables
 | 
					# global static variables
 | 
				
			||||||
LOCALAPPDATA = pathlib.Path(os.getenv('localappdata'))
 | 
					LOCALAPPDATA = pathlib.Path(os.getenv('localappdata'))
 | 
				
			||||||
@ -54,8 +55,9 @@ DRIVER_OPTIONS = ['all',
 | 
				
			|||||||
                  'waifu2x_caffe',
 | 
					                  'waifu2x_caffe',
 | 
				
			||||||
                  'waifu2x_converter_cpp',
 | 
					                  'waifu2x_converter_cpp',
 | 
				
			||||||
                  'waifu2x_ncnn_vulkan',
 | 
					                  'waifu2x_ncnn_vulkan',
 | 
				
			||||||
                  'anime4kcpp',
 | 
					                  'srmd_ncnn_vulkan',
 | 
				
			||||||
                  'srmd_ncnn_vulkan']
 | 
					                  # 'realsr_ncnn_vulkan',
 | 
				
			||||||
 | 
					                  'anime4kcpp']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_arguments():
 | 
					def parse_arguments():
 | 
				
			||||||
@ -103,7 +105,7 @@ class Video2xSetup:
 | 
				
			|||||||
    def _install_python_requirements(self):
 | 
					    def _install_python_requirements(self):
 | 
				
			||||||
        """ Read requirements.txt and return its content
 | 
					        """ Read requirements.txt and return its content
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        pip_install('requirements.txt')
 | 
					        pip_install('requirements-windows.txt')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _cleanup(self):
 | 
					    def _cleanup(self):
 | 
				
			||||||
        """ Cleanup all the temp files downloaded
 | 
					        """ Cleanup all the temp files downloaded
 | 
				
			||||||
@ -209,6 +211,32 @@ class Video2xSetup:
 | 
				
			|||||||
            # rename the newly extracted directory
 | 
					            # rename the newly extracted directory
 | 
				
			||||||
            (LOCALAPPDATA / 'video2x' / zipf.namelist()[0]).rename(waifu2x_ncnn_vulkan_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):
 | 
					    def _install_anime4kcpp(self):
 | 
				
			||||||
        """ Install Anime4KCPP
 | 
					        """ Install Anime4KCPP
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user