def checkConfig(): if fileManager.isExist(".\\data\\config.json"): printl("加载配置文件") getConfigByFile() printConfig() huoqu(1) else: printl("初次配置") openMenu() printConfig() printl("加载日志") if fileManager.isExist('.\\data\\downloaded.json'): setDownloaded() else: fileManager.createJsonFile([], 'downloaded.json')
def loginByFile(self): if fileManager.isExist(".\\data\\token.dat"): self.mytoken=fileManager.readToken() print (self.mytoken) #return self.testConn() return 0 else: return 1
def getPic(self,picture,savepath): print(str(picture['fileServer'])+"/static/"+str(picture['path'])) if not fileManager.isExist(savepath): return self.mrp.sendPost(str(picture['fileServer'])+"/static/"+str(picture['path']),savepath,"img",self.mytoken) else: print('图片已存在!') return 1
def getPic(self, picture, savepath): if self.event.isStartDownload == 0: self.event.printl('下载已暂停') while True: time.sleep(1) if self.event.isStartDownload == 1: break print("正在下载:" + str(picture['fileServer']) + "/static/" + str(picture['path'])) if not fileManager.isExist(savepath): return self.mrp.sendPost( str(picture['fileServer']) + "/static/" + str(picture['path']), savepath, "img", self.mytoken) else: print('图片已存在!') return 1
def getPic(self, picture, savepath): if self.event.isStartDownload == 0: self.event.printl('下载已暂停') while True: time.sleep(1) if self.event.isStartDownload == 1: break elif self.event.isStartDownload == 2: return -1 if not fileManager.isExist(savepath): tmp = self.mrp.sendPost( str(picture['fileServer']) + "/static/" + str(picture['path']), savepath, "img", self.mytoken) if not self.event.checkError(tmp): self.event.printl("此张图片已被搁置,可以在失败记录中重新下载") else: return 1