Download script and note on (new) additional asset pack [skip ci]
This commit is contained in:
parent
b672bee4e5
commit
1dd45a4ddf
4 changed files with 65 additions and 1 deletions
29
download_assets.py
Normal file
29
download_assets.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import sys
|
||||
from urllib.request import urlretrieve
|
||||
from zipfile import ZipFile
|
||||
|
||||
ASSET_PACK_URL = 'http://vulkan.gpuinfo.org/downloads/vulkan_asset_pack.zip'
|
||||
ASSET_PACK_FILE_NAME = 'vulkan_asset_pack.zip'
|
||||
|
||||
print("Downloading asset pack from '%s'" % ASSET_PACK_URL)
|
||||
|
||||
def reporthook(blocknum, blocksize, totalsize):
|
||||
bytesread = blocknum * blocksize
|
||||
if totalsize > 0:
|
||||
percent = bytesread * 1e2 / totalsize
|
||||
s = "\r%5.1f%% (%*d / %d bytes)" % (percent, len(str(totalsize)), bytesread, totalsize)
|
||||
sys.stderr.write(s)
|
||||
if bytesread >= totalsize:
|
||||
sys.stderr.write("\n")
|
||||
else:
|
||||
sys.stderr.write("read %d\n" % (bytesread,))
|
||||
|
||||
urlretrieve(ASSET_PACK_URL, ASSET_PACK_FILE_NAME, reporthook)
|
||||
|
||||
print("Download finished")
|
||||
|
||||
print("Extracting assets")
|
||||
|
||||
zip = ZipFile(ASSET_PACK_FILE_NAME, 'r')
|
||||
zip.extractall("./")
|
||||
zip.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue