From 58ef92792f8d29ce2ab7654b820923ba58e3a33a Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 29 Mar 2022 06:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E5=B9=95=E5=B0=BD=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=8F=8A=E6=97=B6=E5=86=99=E5=85=A5=EF=BC=8C=E4=B8=8B=E6=8B=A8?= =?UTF-8?q?=E5=90=8E=E5=8F=8A=E6=97=B6=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Common.py b/Common.py index 1ee0026..a75373a 100644 --- a/Common.py +++ b/Common.py @@ -315,6 +315,10 @@ class downloader(XiGuaLiveApi): __danmakuFile = None __danmakuBiasTime = None + def getDanmaku(self): + if self.__danmakuFile is not None and self.__danmakuFile.writable(): + self.__danmakuFile.flush() + def onPresentEnd(self, gift): if self.__danmakuFile is not None and self.__danmakuFile.writable(): now = datetime.now() @@ -354,6 +358,10 @@ class downloader(XiGuaLiveApi): return _prev_status _result = super(downloader, self).updRoomInfo(force) if _prev_status != self.isLive and not self.isLive: + # 及时保存 + self.__danmakuFile.close() + self.__danmakuFile = None + self.__danmakuBiasTime = None resetDelay() broadcaster = self.broadcaster if _result: