import os
import sys
import requests
import wget
from tqdm import tqdm

if len(sys.argv) != 2:
    print('You must enter the model name as a parameter, e.g.: download_model.py 117M')
    sys.exit(1)

if sys.argv[1] == '117M':
    model = sys.argv[1]
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
#        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
#        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
#        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
#        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
elif sys.argv[1] == '1250M':
    model = sys.argv[1]
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
elif sys.argv[1] == '1250M-143':
    model = '1250M'
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
#        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
#        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
#        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
#        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
elif sys.argv[1] == '1250M-282':
    model = '1250M'
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
#        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
#        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
#        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
#        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
else:
    print('такой модели нет')

#subdir = subdir.replace('\\','/') # needed for Windows
print(subdir)

import os
import sys
import requests
import wget
from tqdm import tqdm

if len(sys.argv) != 2:
    print('You must enter the model name as a parameter, e.g.: download_model.py 117M')
    sys.exit(1)

if sys.argv[1] == '117M':
    model = sys.argv[1]
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
#        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
#        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
#        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
#        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
elif sys.argv[1] == '1250M':
    model = sys.argv[1]
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
elif sys.argv[1] == '1250M-143':
    model = '1250M'
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
#        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
#        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
#        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
#        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
elif sys.argv[1] == '1250M-282':
    model = '1250M'
    subdir = os.path.join('models', model)
    if not os.path.exists(subdir):
        os.makedirs(subdir)
        os.chdir(subdir)
#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json
#        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index
#        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta
#        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap
#        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model
else:
    print('такой модели нет')

#subdir = subdir.replace('\\','/') # needed for Windows
print(subdir)

#        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json #        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index #        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta #        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap #        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model #hparams.json #model-62000.index #model-62000.meta #sp.vocap #sp.model #        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json #        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index #        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta #        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap #        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model #        wget.download('https://docs.google.com/uc?export=download&id=16xNiQZenM-rhVVPox9oepthwreIEW2Lm') #hparams.json #        wget.download('https://docs.google.com/uc?export=download&id=12zx_JHlY6UeBOQahOxwBnLVXcmZWOXFZ') #model-62000.index #        wget.download('https://docs.google.com/uc?export=download&id=1VvXSt77MWV-BikB59BvcRHynNNCsHeRj') #model-62000.meta #        wget.download('https://docs.google.com/uc?export=download&id=1Lj5gAxD2HHf0VxlHY9Q0q532VNFpQ6XK') #sp.vocap #        wget.download('https://docs.google.com/uc?export=download&id=1bOtPl_GqX4Es9jBZYTPS9ytxq2KGJQE-') #sp.model #subdir = subdir.replace('\\','/') # needed for Windows