diff --git a/tools/subtitle_downloader.py b/tools/subtitle_downloader.py index 385978d..7807ed8 100644 --- a/tools/subtitle_downloader.py +++ b/tools/subtitle_downloader.py @@ -252,7 +252,7 @@ class SubtitleDownloader: target_dir = Path(save_dir) if save_dir else self.download_dir target_dir.mkdir(parents=True, exist_ok=True) - # 이미 같은 파일명이 존재하면 스킵 + # 이미 같은 파일명이 존재하면 스킵 (1차 — 원본 파일명 기준) existing = target_dir / sub.filename if existing.exists() and existing.stat().st_size > 0: logger.info(f"자막 이미 존재, 스킵: {existing}") @@ -280,7 +280,13 @@ class SubtitleDownloader: if m: sub.filename = unquote(m.group(1).strip()) + # 실제 파일명으로 2차 존재 체크 (Content-Disposition 반영 후) filepath = target_dir / sub.filename + if filepath.exists() and filepath.stat().st_size > 0: + logger.info(f"자막 이미 존재 (실제 파일명), 스킵: {filepath}") + sub.local_path = str(filepath) + return str(filepath) + filepath.write_bytes(resp.content) # ZIP/7z 자동 해제