def MultiDownImg(domain,imgLinkList,dir): mth=MyThread.CMultiDownThread(10) for img in imgLinkList: imglink=domain+img["src"] imgName = imglink.split("/")[-1] imgPath=dir + "\\"+imgName print(imgPath) th = MyThread.CDownThread(imglink, imgPath) while not mth.AddThread(th): sleep(5) mth.join()
def MultiDownImgP(domain,subDirList,subsubImgDir,bParse=False): mth=MyThread.CMultiDownThread(10) for dir in subDirList: print("-------%s------" %dir) imgList=[] common.readLinkFile(dir+"\\img.txt",imgList) if not os.path.exists(dir + "\\%s\\"%subsubImgDir): os.makedirs(dir + "\\%s\\"%subsubImgDir) for img in imgList: if bParse: img=GetRealImg(img,".png") name=img.split("/")[-1] print(name) th=MyThread.CDownThread(domain+img,dir+"\\%s\\%s" %(subsubImgDir,name)) while not mth.AddThread(th): sleep(5) mth.join()