예제 #1
0
파일: downloader.py 프로젝트: wgaylord/EMCP
def DownloadFile(SaveLoc,DownloadURL,Item):
    (dirParent, filename) = os.path.split(SaveLoc)
    try:
       os.makedirs(dirParent)
    except:
       pass
    if(os.path.exists(SaveLoc)):
        os.remove(SaveLoc)
    with tqdm(unit='B', unit_scale=True, leave=True, miniters=1,
          desc=Item) as t:
        urllib.urlretrieve(DownloadURL,SaveLoc , reporthook=my_hook(t))
    print("\n")
예제 #2
0
파일: downloader.py 프로젝트: wgaylord/EMCP
def DownloadZip(SaveLoc,DownloadURL,Item,Canskip=True):
   # print("Preparing to download - "+ Item)
    (dirParent, filename) = os.path.split(SaveLoc)
    try:
       os.makedirs(dirParent)
    except:
       pass
    skip = isZip(SaveLoc)
    if not Canskip:
        skip = False
    if not skip:
        if os.path.exists(SaveLoc):
            os.remove(SaveLoc)
        
        with tqdm(unit='B', unit_scale=True, leave=True, miniters=1,
          desc=Item) as t:
            urllib.urlretrieve(DownloadURL,SaveLoc , reporthook=my_hook(t))
      #  sys.stdout.flush()
    else:
        print("Fetching "+Item+" - SKIPPED")
    print("\n")