From 3f749bb8b5b0f9369a3f70f6e732f1a40b0286a5 Mon Sep 17 00:00:00 2001 From: SuperSonic Date: Mon, 14 Oct 2019 21:03:18 +0800 Subject: [PATCH] Release v6.5.2 --- libs/data.py | 1 + libs/yuuki.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libs/data.py b/libs/data.py index 3f63ecc..7ab61cb 100644 --- a/libs/data.py +++ b/libs/data.py @@ -193,6 +193,7 @@ class Yuuki_Data: for Type in self.DataType: with self.file(Type, "w", "Data") as f: f.write(json.dumps(self.Data[Type])) + return self.getData(["Global","Power"]) def updateData(self, path, data): if self.threading: diff --git a/libs/yuuki.py b/libs/yuuki.py index 6037e16..0c9f772 100644 --- a/libs/yuuki.py +++ b/libs/yuuki.py @@ -110,7 +110,6 @@ class Yuuki: self.data = Yuuki_Data(self.Threading) - self.data.updateData(["Global","Power"], True) self.data.updateData(["Global","GroupJoined"], self.client.getGroupIdsJoined()) self.data.updateData(["Global","SecurityService"], self.YuukiConfigs["SecurityService"]) @@ -802,7 +801,10 @@ class Yuuki: if "LastResetLimitTime" not in self.data.getData(["Global"]): self.data.updateData(["Global", "LastResetLimitTime"], None) - while self.data.getData(["Global","Power"]): + Power = True + self.data.updateData(["Global","Power"], Power) + + while Power: try: if time.localtime().tm_hour != self.data.getData(["Global", "LastResetLimitTime"]): self.limitReset() @@ -828,7 +830,13 @@ class Yuuki: if len(cacheOperations) > 1: self.revision = max(cacheOperations[-1].revision, cacheOperations[-2].revision) - self.data.syncData() + Power = self.data.syncData() + + except requests.exceptions.ConnectionError: + Power = False + + except SystemExit: + Power = False except KeyboardInterrupt: self.exit()