Example #1
0
def daily_job():
    while (1):
        Auth.work()
        Capsule.work()
        Coin2Silver.work()
        GiftSend.work()
        Group.work()
        Heart.work()
        Silver2Coin.work()
        SilverBox.work()
        Task.work()
        # 休息0.5s,减少CPU占用
        time.sleep(0.5)
Example #2
0
async def main():

    daily_tasks = [
        CaseJudger.work(),
        Coin2Silver.work(),
        GiftSend.work(),
        Group.work(),
        Silver2Coin.work(),
        Task.work(),
        MainDailyTask.work(),
        MatchTask.work()
    ]

    # 先登陆一次
    Auth.work()

    for task in daily_tasks:
        await task
Example #3
0
                obj=get_gift_of_captain(roomid,capid)
                if obj['code']==0:
                    Log.info(str(roomid)+" 获取亲密度 "+str(obj['data']['award_text']))
                elif obj['code']==-403:
                    #发现被封禁立刻终止
                    Log.info("疑似被封禁"+str(obj))
                    break
                else:
                    Log.info("领取失败"+str(obj))
                #随机延迟5-10秒
                time.sleep(5+int(random.random()*10))

Log.info("\n======START======"+str(time.asctime())+"============\n")

a=Auth()
a.work()
csrf = config['Token']['CSRF']
Log.info(str(csrf))
cookie = config['Token']['COOKIE']
Log.info(str(cookie))

capdone = json.load(open("done.json"))
capdone2={}    

#capdone={}

nhour=time.localtime().tm_hour

nlevel=0

#每日签到
Example #4
0
    MonitorServer.run_forever()
]
danmu_tasks = [Danmu_Monitor.run_Danmu_Raffle_Handler(i) for i in area_ids]
other_tasks = [
    rafflehandler.run()
]

api_thread = threading.Thread(target=API.work)
api_thread.start()

if not options.disable_console:
    console_thread = threading.Thread(target=console.cmdloop)
    console_thread.start()

# 先登陆一次,防止速度太快导致抽奖模块出错
Auth.work()

if config["Function"]["RAFFLE_HANDLER"] != "False":
    if config["Server"]["PERFER_SERVER"] != "False":
        loop.run_until_complete(asyncio.wait(daily_tasks+server_tasks+other_tasks))
    else:
        loop.run_until_complete(asyncio.wait(daily_tasks+danmu_tasks+other_tasks))
else:
    loop.run_until_complete(asyncio.wait(daily_tasks))

api_thread.join()

if not options.disable_console:
    console_thread.join()

loop.close()
Example #5
0
def main():
    # 开启时清理日志
    Log.clean_log(startup=True)

    def signal_handler(signal, frame):
        os._exit(0)

    if config["Other"]["INFO_MESSAGE"] != "False":
        Log.info("BiliBiliHelper Python " + version)
        Log.info("Powered By TheWanderingCoel with love❤️")

    if config["Other"]["SENTENCE"] != "False":
        Log.info(Sentence().get_sentence())

    # 检查Config
    ConfigCheck()

    # 注册信号
    signal.signal(signal.SIGINT, signal_handler)

    loop = asyncio.get_event_loop()

    timer = Timer(loop)
    console = Console.Console(loop)

    area_ids = [
        1,
        2,
        3,
        4,
        5,
        6,
    ]
    Statistics(len(area_ids))

    daily_tasks = [
        Capsule.work(),
        CaseJudger.work(),
        Coin2Silver.work(),
        DailyBag.work(),
        GiftSend.work(),
        Group.work(),
        Heart.work(),
        Silver2Coin.work(),
        SilverBox.work(),
        Task.work()
    ]
    server_tasks = [MonitorServer.run_forever()]
    danmu_tasks = [Danmu_Monitor.run_Danmu_Raffle_Handler(i) for i in area_ids]
    other_tasks = [rafflehandler.run()]

    api_thread = threading.Thread(target=API.work)
    api_thread.start()

    if not options.disable_console:
        console_thread = threading.Thread(target=console.cmdloop)
        console_thread.start()

    # 先登陆一次,防止速度太快导致抽奖模块出错
    Auth.work()

    if config["Function"]["RAFFLE_HANDLER"] != "False":
        loop.run_until_complete(
            asyncio.wait(daily_tasks + server_tasks + danmu_tasks +
                         other_tasks))
    else:
        loop.run_until_complete(asyncio.wait(daily_tasks))

    api_thread.join()

    if not options.disable_console:
        console_thread.join()

    loop.close()