diff --git a/core/monitor.py b/core/monitor.py index fa98b64..0c32105 100644 --- a/core/monitor.py +++ b/core/monitor.py @@ -46,15 +46,14 @@ class Monitor(callback.CallBack): Config.set('host', self._socket.ws_url) def go_login(self): - threading.Thread(target=self._auto_login,args=()).start() + threading.Thread(target=self._auto_login, args=(), name='auto_login_thread').start() def _auto_login(self): user_list = UserList.query(status=Status.ONLINE) for user in user_list: print("自动登录->", user) self.login(user.email, user.password, user.format_cookie(), user.user_agent) - time.sleep(0.2) - + time.sleep(0.3) def _replace_call(self, client): funcs = [x for x in dir(self) if x.startswith("on")] diff --git a/setup.py b/setup.py index 3c3ef8a..5cf2aea 100644 --- a/setup.py +++ b/setup.py @@ -3,4 +3,24 @@ # @Time : 2020-02-07 13:45 # @Author : Lemon # @File : setup.py.py -# @Software: PyCharm \ No newline at end of file +# @Software: PyCharm + +from bin import start +import os + +with os.popen('pip3 freeze') as p: + all = p.read().lower() + +current = [x.split('==')[0] for x in all.split('\n')] + +with open('requirements.txt', 'r') as f: + need = f.read().lower() + +li = [(x.split('==')[0], x.split('==')[1],) for x in need.split('\n')] +for name, ver in li: + if not name in current: + print('正在安装缺少的库: %s==%s' % (name, ver)) + res = os.popen('pip3 install %s==%s' % (name, ver)).read() + print(res) + +start.core.run()