This commit is contained in:
Glenn Jocher 2019-08-04 17:42:27 +02:00
parent 09a89da8a8
commit f0762134ce
1 changed files with 2 additions and 2 deletions

View File

@ -13,6 +13,7 @@ def gdrive_download(files=(('1HaXkef9z6y5l4vUnCYgdmEAj61c6bfWO', 'coco.zip'))):
# from utils.google_utils import *; gdrive_download()
for (id, name) in files:
print('Downloading ''https://drive.google.com/uc?export=download&id=%s'' as ''%s''...' % (id, name))
if os.path.exists(name): # remove existing
os.remove(name)
@ -22,10 +23,9 @@ def gdrive_download(files=(('1HaXkef9z6y5l4vUnCYgdmEAj61c6bfWO', 'coco.zip'))):
# Attempt large file download
if not os.path.exists(name): # file size > 40MB
print('Google Drive file ''%s'' > 40 MB, attempting large file download...' % name)
s = ["curl -c ./cookie -s -L \"https://drive.google.com/uc?export=download&id=%s\" > /dev/null" % id,
"curl -Lb ./cookie \"https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=%s\" -o %s" % (
id, name),
id, name),
'rm ./cookie']
[os.system(x) for x in s] # run commands