录播延迟投稿,注释补全
This commit is contained in:
parent
f96dd9448b
commit
6acc94b7c5
@ -40,7 +40,7 @@ config = {
|
||||
doCleanTime = datetime.now()
|
||||
loginTime = datetime.now()
|
||||
_clean_flag = None
|
||||
delay = 30
|
||||
delay = datetime.now()
|
||||
b = Bilibili()
|
||||
|
||||
network = [{
|
||||
@ -73,7 +73,7 @@ def reloadConfig():
|
||||
|
||||
def resetDelay():
|
||||
global delay
|
||||
delay = config['dly']
|
||||
delay = datetime.now() + timedelta(minutes=int(config['dly']))
|
||||
|
||||
|
||||
def doDelay():
|
||||
@ -81,10 +81,7 @@ def doDelay():
|
||||
if isBroadcasting or isEncode or isUpload:
|
||||
resetDelay()
|
||||
return False
|
||||
if delay < 0:
|
||||
return False
|
||||
delay -= 1
|
||||
return delay < 0
|
||||
return getTimeDelta(datetime.now(), delay) < 0
|
||||
|
||||
|
||||
def updateNetwork():
|
||||
|
15
api.py
15
api.py
@ -114,12 +114,25 @@ class XiGuaLiveApi:
|
||||
print("消息 :", user, "关注了主播")
|
||||
|
||||
def onJoin(self, user: User):
|
||||
"""
|
||||
加入粉丝团消息
|
||||
:param user:
|
||||
"""
|
||||
print("欢迎", user, "加入了粉丝团")
|
||||
|
||||
def onMessage(self, msg: str):
|
||||
"""
|
||||
系统消息
|
||||
:param msg:
|
||||
"""
|
||||
print("消息 :", msg)
|
||||
|
||||
def onLike(self, user: User):
|
||||
"""
|
||||
点击喜欢的消息
|
||||
On Like
|
||||
:param user:
|
||||
"""
|
||||
print("用户", user, "点了喜欢")
|
||||
|
||||
def onLeave(self, json: any):
|
||||
@ -211,8 +224,10 @@ class XiGuaLiveApi:
|
||||
self.isLive = d["room"]["status"] == 2
|
||||
self.roomTitle = d["room"]["title"]
|
||||
self.roomPopularity = d["room"]["user_count"]
|
||||
# 处理抽奖事件
|
||||
l = Lottery(d)
|
||||
if l.isActive:
|
||||
# 因为现在每个房间只能同时开启一个抽奖,所以放一个就行了
|
||||
self.lottery = l
|
||||
return True
|
||||
|
||||
|
@ -127,7 +127,7 @@ def run():
|
||||
Common.appendError(e.__str__())
|
||||
time.sleep(5)
|
||||
continue
|
||||
time.sleep(5)
|
||||
time.sleep(1)
|
||||
else:
|
||||
try:
|
||||
Common.api.updRoomInfo()
|
||||
@ -144,4 +144,4 @@ def run():
|
||||
Common.forceStartUploadThread = False
|
||||
if Common.doDelay():
|
||||
Common.uploadQueue.put(True)
|
||||
time.sleep(15)
|
||||
time.sleep(5)
|
||||
|
Reference in New Issue
Block a user