Beispiel #1
0
    def __Check_Project_Answer(self) -> None:
        """
        __Check_Project_Answer() -> None
        监测专项答题任务的完成

        :return: None
        """
        while True:
            bar = INFO_MANAGE().Task_Bar
            if bar[4].Current_Score != bar[4].Day_Max_Score:
                if self.__answer_time[-1]:
                    if time.time() - self.__answer_time[0] <= 10:
                        continue
                token = self.__driver.get_cookie(name='token')['value']
                iid = TASK_INIT().Assigning_Project_Answer(token=token)
                if not iid:
                    print("没有专项答题任务了")
                    break
                temp = TASK_ANSWER(driver=self.__driver)
                try:
                    temp.Do(link=API().Project_Answer_Topic.geturl().format(num=iid))
                except TASK_EXCEPTION:
                    DB_MANAGE().Project.Insert(PROJECT(pid=iid))
                OUTPUT.Info()
                self.__answer_time = (time.time(), True)
            else:
                break
    def __Video(self, num: int, tq: int) -> None:
        """
        __Video(num: int) -> None
        进行视频任务

        :param num: 任务数量
        :return: None
        """
        temp = TASK_ARTICLE_VIDEO(task_driver=self.__driver)
        tasks = TASK_INIT().Assigning_Video(num=num)
        bar = tqdm(desc='视频', total=num, unit='it', leave=False, ncols=70)
        for task in tasks:
            temp.Do(task=task, tq=tq)
            DB_MANAGE().Video.Update(video=task)
            bar.update(n=1)
            OUTPUT.Info()
        bar.close()