feat(download): add video download capability for videos without official subtitles
- Add download_video() to BilibiliAdapter using yt-dlp - Add bilibili_cookie config to Settings - Update DownloadProcessor to call video download for bilibili videos - Add idempotency check to ASRProcessor for existing subtitle files - Fix indentation error in asr.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,7 @@ class ASRProcessor:
|
||||
"""执行 ASR 处理
|
||||
|
||||
策略:
|
||||
0. 先检查是否已有字幕文件(幂等性)
|
||||
1. 先尝试官方字幕(仅 B站)
|
||||
2. 无官方字幕则调用 Whisper
|
||||
3. 记录状态
|
||||
@@ -131,13 +132,19 @@ class ASRProcessor:
|
||||
result = None
|
||||
|
||||
try:
|
||||
# Step 1: 尝试官方字幕(仅 B站)
|
||||
if input_data.platform == "bilibili":
|
||||
result = await self._try_official_subtitle(input_data)
|
||||
# Step 0: 检查是否已有字幕文件(幂等性)
|
||||
existing_result = self._check_existing_subtitle_files(input_data)
|
||||
if existing_result:
|
||||
logger.info(f"Found existing subtitle files, skipping processing")
|
||||
result = existing_result
|
||||
else:
|
||||
# Step 1: 尝试官方字幕(仅 B站)
|
||||
if input_data.platform == "bilibili":
|
||||
result = await self._try_official_subtitle(input_data)
|
||||
|
||||
# Step 2: 无官方字幕则调用 Whisper
|
||||
if result is None:
|
||||
result = await self._run_whisper(input_data)
|
||||
# Step 2: 无官方字幕则调用 Whisper
|
||||
if result is None:
|
||||
result = await self._run_whisper(input_data)
|
||||
|
||||
# Step 3: 记录成功状态
|
||||
if self.state_manager:
|
||||
|
||||
Reference in New Issue
Block a user