feat: DramaBox 全量走 App 接口,清单可停止并避免卡死

分类按 App 翻页,精选走推荐接口。清单顶部显示进度,停止后不再拉新剧,已拿到的封面继续加载。列表只绘制可见卡片,避免大量剧目占满主线程。
This commit is contained in:
Nixevol
2026-10-24 03:03:27 +08:00
parent 241762451c
commit cea741eead
25 changed files with 2923 additions and 1070 deletions
+10 -11
View File
@@ -1,9 +1,10 @@
from pathlib import Path
from server.services.downloads import DownloadManager, _plain_text
from server.services.dramabox import api
from server.services.dramabox.app_api import book_brief
from server.services.dramabox.client import USER_AGENT, client
from server.services.dramabox.covers import covers
from server.services.dramabox.private_mp4 import decrypt_file_if_needed
from server.services.dramabox import playlist as db_playlist
ROOT = Path(__file__).resolve().parents[3]
@@ -21,16 +22,13 @@ def _write_intro(folder: Path, drama_id: str, title: str, _token: str, _device)
tags = ""
count = ""
try:
detail = api.book_detail(str(drama_id))
book = detail.get("book") if isinstance(detail, dict) else None
if isinstance(book, dict):
fetched = str(book.get("bookName") or "").strip()
if fetched:
name = fetched
desc = _plain_text(book.get("introduction") or "")
language = str(book.get("simpleLanguage") or language)
tags = "、".join(str(item) for item in (book.get("typeTwoNames") or []) if item)
count = str(book.get("chapterCount") or "")
detail = book_brief(str(drama_id))
fetched = detail.get("name") or ""
if fetched:
name = fetched
desc = _plain_text(detail.get("introduction") or "")
tags = detail.get("tags") or ""
count = detail.get("count") or ""
profile = client.profile or {}
country = str(profile.get("country") or "")
except Exception:
@@ -65,4 +63,5 @@ downloads = DownloadManager(
read_cover=_read_cover,
current_auth=_auth,
headers={"User-Agent": USER_AGENT, "Referer": "https://www.dramaboxapp.com/", "Origin": "https://www.dramaboxapp.com"},
prepare_file=decrypt_file_if_needed,
)