def __init__(self, model1, model2): self.model1 = model1 self.model2 = model2 print("init_Server") gl._init() # gl.set_value("inferModel", model) gl.set_value("inferserver", self)
def OnInit(self): self.frame = MyFrame() self.TaskBar = MyTaskBarIcon(self.frame) # 显示系统托盘图标 # self.timer = ClockWindow() gl.set_value('logwindow', self) # self.SetTopWindow(self.frame) self.frame.Show() self.frame.Raise() wx.CallLater(1000, self.checkptthread) self.setclearlogtimer() pub.subscribe(self.updateHandle, "update") return True
def onExit(self, event): if not self.loginflag[0]: gl.set_value('logindata', [ False, { 'username': '', 'password': '', 'captcha': '', 'secondverify': '' } ]) self.loginflag[0] = True self.Destroy()
def getlogindata(self, event): if self.textinput_pwd.GetValue() == '' \ or self.textinput_captcha.GetValue() == '' \ or self.textinput_user.GetValue() == '': wx.MessageBox('用户名密码验证码不能为空', "Error") return gl.set_value('logindata', [ True, { 'username': self.textinput_user.GetValue(), 'password': self.textinput_pwd.GetValue(), 'captcha': self.textinput_captcha.GetValue(), 'secondverify': self.textinput_secondverify.GetValue() } ]) self.loginflag[0] = True self.Close()
def run(): logger = gl.get_value('logger').logger try: maxtime = 1 auto_byr = None auto_tju = None auto_pter = None auto_mteam = None auto_pthome = None auto_frds = None auto_ttg = None auto_lemonhd = None Runqbittorrent() refconfig = { 'name': 'reseed', 'ref': { 'byr': auto_byr, 'tju': auto_tju, 'mteam': auto_mteam, 'pter': auto_pter, 'pthome': auto_pthome, 'frds': auto_frds, 'ttg': auto_ttg, 'lemonhd': auto_lemonhd, } } gl.set_value('allref', refconfig) auto_byr = AutoPT_BYR() refconfig['ref']['byr'] = auto_byr auto_tju = AutoPT_TJU() refconfig['ref']['tju'] = auto_tju auto_pter = AutoPT_PTER() refconfig['ref']['pter'] = auto_pter auto_mteam = AutoPT_MTEAM() refconfig['ref']['mteam'] = auto_mteam auto_pthome = AutoPT_PTHOME() refconfig['ref']['pthome'] = auto_pthome auto_frds = AutoPT_FRDS() refconfig['ref']['frds'] = auto_frds auto_ttg = AutoPT_TTG() refconfig['ref']['ttg'] = auto_ttg auto_lemonhd = AutoPT_LEMONHD() refconfig['ref']['lemonhd'] = auto_lemonhd if gl.get_value('config').switch('byr'): if maxtime % gl.get_value('config').intervaltime('byr') != 0: maxtime *= gl.get_value('config').intervaltime('byr') if gl.get_value('config').switch('tju'): if maxtime % gl.get_value('config').intervaltime('tju') != 0: maxtime *= gl.get_value('config').intervaltime('tju') if gl.get_value('config').switch('pter'): if maxtime % gl.get_value('config').intervaltime('pter') != 0: maxtime *= gl.get_value('config').intervaltime('pter') if gl.get_value('config').switch('mteam'): if maxtime % gl.get_value('config').intervaltime('mteam') != 0: maxtime *= gl.get_value('config').intervaltime('mteam') if gl.get_value('config').switch('pthome'): if maxtime % gl.get_value('config').intervaltime('pthome') != 0: maxtime *= gl.get_value('config').intervaltime('pthome') if gl.get_value('config').switch('frds'): if maxtime % gl.get_value('config').intervaltime('frds') != 0: maxtime *= gl.get_value('config').intervaltime('frds') if gl.get_value('config').switch('ttg'): if maxtime % gl.get_value('config').intervaltime('ttg') != 0: maxtime *= gl.get_value('config').intervaltime('ttg') if gl.get_value('config').switch('lemonhd'): if maxtime % gl.get_value('config').intervaltime('lemonhd') != 0: maxtime *= gl.get_value('config').intervaltime('lemonhd') manager = Manager() if maxtime % (6 * 3600) != 0: maxtime *= (6 * 3600) counttime = 0 while gl.get_value('thread_flag'): if gl.get_value('config').switch( 'reseed') and counttime % 120 == 0: manager.checkalltorrentexist() manager.recheck() if gl.get_value('config').switch( 'reseed') and counttime % (3 * 3600) == 0: manager.checkprttracker() manager.recheckall() manager.checkemptydir() if gl.get_value('thread_flag') and gl.get_value('config').switch( 'lemonhd') and counttime % gl.get_value( 'config').intervaltime('lemonhd') == 0: auto_lemonhd.start() pass if gl.get_value('thread_flag') and gl.get_value('config').switch( 'ttg' ) and counttime % gl.get_value('config').intervaltime('ttg') == 0: auto_ttg.start() pass if gl.get_value('thread_flag') and gl.get_value('config').switch( 'frds' ) and counttime % gl.get_value('config').intervaltime('frds') == 0: auto_frds.start() pass if gl.get_value('thread_flag') and gl.get_value('config').switch( 'pthome') and counttime % gl.get_value( 'config').intervaltime('pthome') == 0: auto_pthome.start() if gl.get_value('thread_flag') and gl.get_value('config').switch( 'mteam') and counttime % gl.get_value( 'config').intervaltime('mteam') == 0: auto_mteam.start() if gl.get_value('thread_flag') and gl.get_value('config').switch( 'tju' ) and counttime % gl.get_value('config').intervaltime('tju') == 0: auto_tju.start() if gl.get_value('thread_flag') and gl.get_value('config').switch( 'pter' ) and counttime % gl.get_value('config').intervaltime('pter') == 0: auto_pter.start() if gl.get_value('thread_flag') and gl.get_value('config').switch( 'byr' ) and counttime % gl.get_value('config').intervaltime('byr') == 0: auto_byr.start() counttime = (1 + counttime) % maxtime time.sleep(1) except BaseException: logger.exception(traceback.format_exc())
trytime -= 5 logger.info('正在等待QBT启动') time.sleep(5) if trytime <= 0: logger.error('QBT启动失败,异常退出') else: logger.error('QBT启动成功') else: logger.debug('QBitTorrent已在运行') except BaseException as e: logger.exception(traceback.format_exc()) if __name__ == '__main__': gl._init() gl.set_value('thread_flag', True) try: gl.set_value('config', Myconfig.Config()) gl.set_value('logger', Mylogger.Mylogger()) gl.set_value('wechat', iyuu(gl.get_value('config').token)) gl.set_value('thread', Thread(target=run)) app = BGIcon.MyWindows() gl.set_value('wxpython', app) gl.get_value('logger').logger.info('程序启动') gl.get_value('thread').start() app.MainLoop() except BaseException: traceback.print_exc(file=open('treace.txt', 'w+')) # gl.get_value('logger').logger.exception(traceback.format_exc())