diff --git a/docs/devlog/2026-03-21.md b/docs/devlog/2026-03-21.md new file mode 100644 index 0000000..cf01471 --- /dev/null +++ b/docs/devlog/2026-03-21.md @@ -0,0 +1,3 @@ +| # | 시간 | 작업 | 커밋 | 상태 | +|----|------|------|------|------| +| 001 | 12:00 | 자막 다운로드 Flow 정밀검증 — 과다 다운로드/리네임 미실행/오류 표현 5건 수정 | `94fb4e6` | ✅ | diff --git a/tools/anime_pipeline.py b/tools/anime_pipeline.py index 56b5784..9f4f80c 100644 --- a/tools/anime_pipeline.py +++ b/tools/anime_pipeline.py @@ -731,7 +731,7 @@ class AnimePipeline: # resolve 시점의 캐시 대신 실제 NAS 폴더에서 현재 자막 파일 스캔 try: - for f in nas_folder.iterdir(): + for f in nas_folder.rglob("*"): if f.suffix.lower() in SUB_EXTS and f.is_file(): existing_sub_files.add(f.name.lower()) ep = self._extract_episode(f.name) @@ -800,14 +800,21 @@ class AnimePipeline: actual_ep = self._extract_episode(actual_name) if actual_ep is not None: existing_sub_eps.add(actual_ep) + # ZIP 해제 시 모든 해제된 파일을 existing에 등록 (중복 다운 방지) + for sibling in nas_folder.iterdir(): + if sibling.suffix.lower() in SUB_EXTS and sibling.is_file(): + sname = sibling.name.lower() + if sname not in existing_sub_files: + existing_sub_files.add(sname) + sep = self._extract_episode(sibling.name) + if sep is not None: + existing_sub_eps.add(sep) except Exception as e: result.errors.append(f"자막 다운로드 실패 ({sub.filename}): {e}") except Exception as e: # URL이 404일 수 있으므로 debug만 logger.debug(f"자막 URL 접근 실패: {url} - {e}") - # 자막 리네임 - self._rename_subtitles_to_match_videos(nas_folder, result, offset=unit.episode_offset) def _discover_episode_urls( self, @@ -913,8 +920,8 @@ class AnimePipeline: if not videos: return - for f in folder.iterdir(): - if f.suffix.lower() not in SUB_EXTS: + for f in folder.rglob("*"): + if not f.is_file() or f.suffix.lower() not in SUB_EXTS: continue ep = self._extract_episode(f.stem) if ep is None: @@ -961,7 +968,7 @@ class AnimePipeline: ): """토렌트 추가 — WorkUnit의 기존 데이터 사용 (재스캔 없음).""" if not unit.torrents: - result.errors.append("매칭되는 토렌트가 없습니다.") + result.message += "\n⚠ 매칭되는 토렌트가 없습니다." return # WorkUnit에서 기존 정보 사용