From 361490fc43340d9c6738dc8ef7dc0940f501ca44 Mon Sep 17 00:00:00 2001 From: projectdx Date: Tue, 31 Jan 2023 21:19:40 +0900 Subject: [PATCH] =?UTF-8?q?2022.01.31=20anilife=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=ED=94=BD=EC=8A=A4=20(.04.=20=EA=B8=B0=ED=83=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugin/ffmpeg_queue.py | 9 ++++-- logic_anilife.py | 28 +++++++++++++++++-- .../anime_downloader_anilife_request.html | 18 ++++-------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/lib/plugin/ffmpeg_queue.py b/lib/plugin/ffmpeg_queue.py index b8abe38..6b29b4b 100644 --- a/lib/plugin/ffmpeg_queue.py +++ b/lib/plugin/ffmpeg_queue.py @@ -1,10 +1,13 @@ # -*- coding: utf-8 -*- ######################################################### # python -import os, sys, traceback -import threading, time -from datetime import datetime import abc +import os +import threading +import time +import traceback +from datetime import datetime + from framework import py_queue diff --git a/logic_anilife.py b/logic_anilife.py index 91c75a2..b6e6d3f 100644 --- a/logic_anilife.py +++ b/logic_anilife.py @@ -52,10 +52,12 @@ from framework.common.util import headers from plugin import ( LogicModuleBase, default_route_socketio, + FfmpegQueue, + FfmpegQueueEntity, ) # 철자가 틀린 부분이 있어서 분리함 -from .lib.plugin import FfmpegQueue, FfmpegQueueEntity +# from .lib.plugin import FfmpegQueue, FfmpegQueueEntity from tool_base import d # 패키지 @@ -565,7 +567,7 @@ class LogicAniLife(LogicModuleBase): har = await tracer.flush() # page.wait_for_timeout(10000) - await asyncio.sleep(2) + await asyncio.sleep(1) # logger.debug(har) # page.reload() @@ -591,11 +593,16 @@ class LogicAniLife(LogicModuleBase): tmp_video_url = [] for i, elem in enumerate(result_har_dict["log"]["entries"]): + # if "m3u8" in elem["request"]["url"]: if "m3u8" in elem["request"]["url"]: logger.debug(elem["request"]["url"]) tmp_video_url.append(elem["request"]["url"]) + logger.debug(tmp_video_url) vod_url = tmp_video_url[-1] + for i, el in enumerate(tmp_video_url): + if el.endswith("m3u8"): + vod_url = el logger.debug(f"vod_url:: {vod_url}") @@ -1041,7 +1048,7 @@ class LogicAniLife(LogicModuleBase): # ret_data = LogicOhli24.get_auto_anime_info(self, url=url) content_info = self.get_series_info(item) - logger.debug(content_info) + # logger.debug(content_info) # exit() for episode_info in content_info["episode"]: @@ -1087,6 +1094,14 @@ class LogicAniLife(LogicModuleBase): .strip() ) + regex = r"\t+" + subst = "" + regex1 = r"[\n]+" + subst1 = "
" + des_items1 = re.sub(regex, subst, des_items1, 0, re.MULTILINE) + des_items1 = re.sub(regex1, subst1, des_items1, 0, re.MULTILINE) + # print(des_items1) + des = {} des_key = [ "_otit", @@ -1331,6 +1346,13 @@ class AniLifeQueueEntity(FfmpegQueueEntity): db_entity.completed_time = datetime.now() db_entity.save() + def donwload_completed(self): + db_entity = ModelAniLifeItem.get_by_anilife_id(self.info["_id"]) + if db_entity is not None: + db_entity.status = "completed" + db_entity.completed_time = datetime.now() + db_entity.save() + def make_episode_info(self): logger.debug("make_episode_info() routine ==========") try: diff --git a/templates/anime_downloader_anilife_request.html b/templates/anime_downloader_anilife_request.html index 2f5ea44..84ab509 100644 --- a/templates/anime_downloader_anilife_request.html +++ b/templates/anime_downloader_anilife_request.html @@ -120,9 +120,11 @@ } function make_program(data) { + current_data = data; // console.log("current_data::", current_data) - str = ''; + let str = ''; + let tmp = ''; tmp = '
' tmp += m_button('check_download_btn', '선택 다운로드 추가', []); tmp += m_button('all_check_on_btn', '전체 선택', []); @@ -143,18 +145,8 @@ tmp = ''; str += m_col(3, tmp) tmp = '' - tmp += m_row_start(2) + m_col(3, '제목', 'right') + m_col(9, data.title) + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '제작사', 'right') + m_col(9, data.des._pub) + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '감독', 'right') + m_col(9, data.des._dir) + m_row_end(); - // - // tmp += m_row_start(2) + m_col(3, '원작', 'right') + m_col(9, data.des._otit) + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '장르', 'right') + m_col(9, data.des._tag) + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '분류', 'right') + m_col(9, data.des._classifi) + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '공식 방영일', 'right') + m_col(9, data.date+'('+data.day+')') + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '에피소드', 'right') + m_col(9, data.des._total_chapter ? data.des._total_chapter : '') + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '등급', 'right') + m_col(9, data.des._grade) + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '최근 방영일', 'right') + m_col(9, data.des._recent_date ? data.des._recent_date : '') + m_row_end(); - // tmp += m_row_start(2) + m_col(3, '줄거리', 'right') + m_col(9, data.ser_description) + m_row_end(); + // tmp += m_row_start(2) + m_col(3, '제목', 'right') + m_col(9, data.title) + m_row_end(); + tmp += '

'+data.title+'

' tmp += "
" + data.des1 + "
" str += m_col(9, tmp)