fix(subtitle): 자막 중복 다운로드 근본 수정 — ZIP 해제 존재체크 + discovered_ep=None 시 전체 스킵

This commit is contained in:
2026-03-19 08:01:22 +09:00
parent a893593f25
commit 190d2ee2a3
2 changed files with 10 additions and 0 deletions

View File

@@ -762,6 +762,11 @@ class AnimePipeline:
logger.info(f"자막 URL 스킵 (기존 존재): ep{discovered_ep}") logger.info(f"자막 URL 스킵 (기존 존재): ep{discovered_ep}")
continue continue
# 에피소드를 모르는 URL: 기존 영상 에피소드 전부 자막 있으면 다운로드 불필요
if discovered_ep is None and unit.existing_eps and unit.existing_eps.issubset(existing_sub_eps):
logger.info(f"자막 URL 스킵 (모든 에피소드 자막 존재): {url[:60]}")
continue
try: try:
subs = await self.sub_downloader.find_subtitles(url) subs = await self.sub_downloader.find_subtitles(url)
for sub in subs: for sub in subs:

View File

@@ -324,6 +324,11 @@ class SubtitleDownloader:
# 중첩 폴더 무시, 파일만 추출 # 중첩 폴더 무시, 파일만 추출
out_name = Path(name).name out_name = Path(name).name
out_path = target_dir / out_name out_path = target_dir / out_name
# 이미 존재하면 스킵 (중복 다운로드 방지)
if out_path.exists() and out_path.stat().st_size > 0:
logger.info(f"ZIP 내 파일 이미 존재, 스킵: {out_name}")
extracted.append(str(out_path))
continue
with zf.open(name) as src, open(out_path, "wb") as dst: with zf.open(name) as src, open(out_path, "wb") as dst:
dst.write(src.read()) dst.write(src.read())
extracted.append(str(out_path)) extracted.append(str(out_path))