feat: 补全短剧全量清单并接入 DramaBox 官网登录
This commit is contained in:
@@ -66,12 +66,18 @@ def convert_to_mp4(episode_dir: Path, mp4_path: Path) -> None:
|
||||
temporary.unlink(missing_ok=True)
|
||||
detail = (completed.stderr or b"").decode("utf-8", "replace")[-400:]
|
||||
raise RuntimeError("转换成 MP4 失败" + (f":{detail}" if detail else ""))
|
||||
if not _output_has_audio(exe, temporary):
|
||||
if not has_audio(temporary):
|
||||
temporary.unlink(missing_ok=True)
|
||||
raise RuntimeError("合成结果没有音轨。音频分片没有下载到,或者音频地址已经过期。")
|
||||
temporary.replace(mp4_path)
|
||||
|
||||
|
||||
def has_audio(media: Path) -> bool:
|
||||
if not media.is_file() or media.stat().st_size <= 0:
|
||||
return False
|
||||
return _output_has_audio(ensure_ffmpeg(), media)
|
||||
|
||||
|
||||
def _output_has_audio(exe: Path, media: Path) -> bool:
|
||||
completed = subprocess.run(
|
||||
[str(exe), "-hide_banner", "-i", str(media)],
|
||||
|
||||
Reference in New Issue
Block a user