更新房间时更新更新时间,测试下播触发条件
This commit is contained in:
parent
74120850a4
commit
68fecca012
@ -153,7 +153,6 @@ dt_format = "%Y/%m/%d %H:%M:%S"
|
|||||||
reloadConfig()
|
reloadConfig()
|
||||||
broadcaster = ""
|
broadcaster = ""
|
||||||
streamUrl = ""
|
streamUrl = ""
|
||||||
updateTime = ""
|
|
||||||
|
|
||||||
forceNotDownload = False
|
forceNotDownload = False
|
||||||
forceNotBroadcasting = False
|
forceNotBroadcasting = False
|
||||||
@ -307,11 +306,10 @@ class downloader(XiGuaLiveApi):
|
|||||||
playlist = None
|
playlist = None
|
||||||
|
|
||||||
def updRoomInfo(self, force=False):
|
def updRoomInfo(self, force=False):
|
||||||
global broadcaster, updateTime
|
global broadcaster
|
||||||
_prev_status = self.isLive
|
_prev_status = self.isLive
|
||||||
doClean()
|
doClean()
|
||||||
_result = super(downloader, self).updRoomInfo(force)
|
_result = super(downloader, self).updRoomInfo(force)
|
||||||
updateTime = datetime.now().strftime(dt_format)
|
|
||||||
if _prev_status != self.isLive:
|
if _prev_status != self.isLive:
|
||||||
resetDelay()
|
resetDelay()
|
||||||
if _result:
|
if _result:
|
||||||
@ -397,7 +395,7 @@ def collectInfomation():
|
|||||||
"broadcaster": broadcaster.__str__(),
|
"broadcaster": broadcaster.__str__(),
|
||||||
"isBroadcasting": api.isLive,
|
"isBroadcasting": api.isLive,
|
||||||
"streamUrl": streamUrl,
|
"streamUrl": streamUrl,
|
||||||
"updateTime": updateTime,
|
"updateTime": api.updateAt.strftime(dt_format),
|
||||||
"delayTime": delay.strftime(dt_format)
|
"delayTime": delay.strftime(dt_format)
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
5
api.py
5
api.py
@ -188,6 +188,7 @@ class XiGuaLiveApi:
|
|||||||
if "user_info" not in d and d["user_info"] is None:
|
if "user_info" not in d and d["user_info"] is None:
|
||||||
self.apiChangedError("Api发生改变,请及时联系我", d)
|
self.apiChangedError("Api发生改变,请及时联系我", d)
|
||||||
return False
|
return False
|
||||||
|
self._updRoomAt = datetime.now()
|
||||||
self.broadcaster = User(d)
|
self.broadcaster = User(d)
|
||||||
if not self._checkUsernameIsMatched():
|
if not self._checkUsernameIsMatched():
|
||||||
self.isLive = False
|
self.isLive = False
|
||||||
@ -230,3 +231,7 @@ class XiGuaLiveApi:
|
|||||||
return self._updateUserInfo()
|
return self._updateUserInfo()
|
||||||
else:
|
else:
|
||||||
return self._getRoomInfo(force)
|
return self._getRoomInfo(force)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def updateAt(self):
|
||||||
|
return self._updRoomAt
|
||||||
|
@ -142,7 +142,7 @@ class Bilibili:
|
|||||||
)
|
)
|
||||||
json = r.json()
|
json = r.json()
|
||||||
|
|
||||||
if json['code'] is not 0:
|
if json['code'] != 0:
|
||||||
return r.text
|
return r.text
|
||||||
|
|
||||||
ls = []
|
ls = []
|
||||||
|
Reference in New Issue
Block a user