44Name: Video2X Setup Script
55Creator: K4YT3X
66Date Created: November 28, 2018
7- Last Modified: May 29 , 2020
7+ Last Modified: May 30 , 2020
88
99Editor: BrianPetkovsek
1010Editor: SAT3LL
4444# Therefore, they will be installed during the Python dependency
4545# installation step and imported later in the script.
4646
47- SETUP_VERSION = '2.2.0 '
47+ SETUP_VERSION = '2.2.1 '
4848
4949# global static variables
5050LOCALAPPDATA = pathlib .Path (os .getenv ('localappdata' ))
5656 'waifu2x_converter_cpp' ,
5757 'waifu2x_ncnn_vulkan' ,
5858 'srmd_ncnn_vulkan' ,
59- # 'realsr_ncnn_vulkan',
59+ 'realsr_ncnn_vulkan' ,
6060 'anime4kcpp' ]
6161
6262
@@ -139,7 +139,7 @@ def _install_gifski(self):
139139 print ('\n Installing Gifski' )
140140 import requests
141141
142- # Get latest release of waifu2x-ncnn-vulkan via Github API
142+ # Get latest release of Gifski via Github API
143143 latest_release = requests .get ('https://api.github.com/repos/ImageOptim/gifski/releases/latest' ).json ()
144144
145145 for a in latest_release ['assets' ]:
@@ -195,7 +195,7 @@ def _install_waifu2x_ncnn_vulkan(self):
195195 latest_release = requests .get ('https://api.github.com/repos/nihui/waifu2x-ncnn-vulkan/releases/latest' ).json ()
196196
197197 for a in latest_release ['assets' ]:
198- if re .search (r'waifu2x-ncnn-vulkan-\d*\.zip' , a ['browser_download_url' ]):
198+ if re .search (r'waifu2x-ncnn-vulkan-\d*-windows \.zip' , a ['browser_download_url' ]):
199199 waifu2x_ncnn_vulkan_zip = download (a ['browser_download_url' ], tempfile .gettempdir ())
200200 self .trash .append (waifu2x_ncnn_vulkan_zip )
201201
@@ -211,6 +211,32 @@ def _install_waifu2x_ncnn_vulkan(self):
211211 # rename the newly extracted directory
212212 (LOCALAPPDATA / 'video2x' / zipf .namelist ()[0 ]).rename (waifu2x_ncnn_vulkan_directory )
213213
214+ def _install_srmd_ncnn_vulkan (self ):
215+ """ Install srmd-ncnn-vulkan
216+ """
217+ print ('\n Installing srmd-ncnn-vulkan' )
218+ import requests
219+
220+ # Get latest release of srmd-ncnn-vulkan via Github API
221+ latest_release = requests .get ('https://api.github.com/repos/nihui/srmd-ncnn-vulkan/releases/latest' ).json ()
222+
223+ for a in latest_release ['assets' ]:
224+ if re .search (r'srmd-ncnn-vulkan-\d*-windows\.zip' , a ['browser_download_url' ]):
225+ srmd_ncnn_vulkan_zip = download (a ['browser_download_url' ], tempfile .gettempdir ())
226+ self .trash .append (srmd_ncnn_vulkan_zip )
227+
228+ # extract and rename
229+ srmd_ncnn_vulkan_directory = LOCALAPPDATA / 'video2x' / 'srmd-ncnn-vulkan'
230+ with zipfile .ZipFile (srmd_ncnn_vulkan_zip ) as zipf :
231+ zipf .extractall (LOCALAPPDATA / 'video2x' )
232+
233+ # if directory already exists, remove it
234+ if srmd_ncnn_vulkan_directory .exists ():
235+ shutil .rmtree (srmd_ncnn_vulkan_directory )
236+
237+ # rename the newly extracted directory
238+ (LOCALAPPDATA / 'video2x' / zipf .namelist ()[0 ]).rename (srmd_ncnn_vulkan_directory )
239+
214240 def _install_realsr_ncnn_vulkan (self ):
215241 """ Install realsr-ncnn-vulkan
216242 """
@@ -221,7 +247,7 @@ def _install_realsr_ncnn_vulkan(self):
221247 latest_release = requests .get ('https://api.github.com/repos/nihui/realsr-ncnn-vulkan/releases/latest' ).json ()
222248
223249 for a in latest_release ['assets' ]:
224- if re .search (r'realsr-ncnn-vulkan-\d*\.zip' , a ['browser_download_url' ]):
250+ if re .search (r'realsr-ncnn-vulkan-\d*-windows \.zip' , a ['browser_download_url' ]):
225251 realsr_ncnn_vulkan_zip = download (a ['browser_download_url' ], tempfile .gettempdir ())
226252 self .trash .append (realsr_ncnn_vulkan_zip )
227253
@@ -266,32 +292,6 @@ def _install_anime4kcpp(self):
266292 shutil .rmtree (LOCALAPPDATA / 'video2x' / 'anime4kcpp' )
267293 patoolib .extract_archive (str (anime4kcpp_7z ), outdir = str (LOCALAPPDATA / 'video2x' / 'anime4kcpp' ))
268294
269- def _install_srmd_ncnn_vulkan (self ):
270- """ Install srmd-ncnn-vulkan
271- """
272- print ('\n Installing srmd-ncnn-vulkan' )
273- import requests
274-
275- # Get latest release of srmd-ncnn-vulkan via Github API
276- latest_release = requests .get ('https://api.github.com/repos/nihui/srmd-ncnn-vulkan/releases/latest' ).json ()
277-
278- for a in latest_release ['assets' ]:
279- if re .search (r'srmd-ncnn-vulkan-\d*\.zip' , a ['browser_download_url' ]):
280- srmd_ncnn_vulkan_zip = download (a ['browser_download_url' ], tempfile .gettempdir ())
281- self .trash .append (srmd_ncnn_vulkan_zip )
282-
283- # extract and rename
284- srmd_ncnn_vulkan_directory = LOCALAPPDATA / 'video2x' / 'srmd-ncnn-vulkan'
285- with zipfile .ZipFile (srmd_ncnn_vulkan_zip ) as zipf :
286- zipf .extractall (LOCALAPPDATA / 'video2x' )
287-
288- # if directory already exists, remove it
289- if srmd_ncnn_vulkan_directory .exists ():
290- shutil .rmtree (srmd_ncnn_vulkan_directory )
291-
292- # rename the newly extracted directory
293- (LOCALAPPDATA / 'video2x' / zipf .namelist ()[0 ]).rename (srmd_ncnn_vulkan_directory )
294-
295295
296296def download (url , save_path , chunk_size = 4096 ):
297297 """ Download file to local with requests library
0 commit comments