From 5fb4179857f3205c441ee73313e32697d9300573 Mon Sep 17 00:00:00 2001 From: Variet Agent Date: Sat, 21 Mar 2026 12:02:00 +0900 Subject: [PATCH] =?UTF-8?q?fix(anime):=20=EC=9E=90=EB=A7=89=20=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=EB=A1=9C=EB=93=9C=205=EA=B1=B4=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=E2=80=94=20=EA=B3=BC=EB=8B=A4=20=EB=8B=A4=EC=9A=B4=EB=A1=9C?= =?UTF-8?q?=EB=93=9C(ZIP=20=EC=B6=94=EC=A0=81),=20=EB=A6=AC=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EB=AF=B8=EC=8B=A4=ED=96=89(rglob),=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=91=9C=ED=98=84(errors=E2=86=92message)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/devlog/2026-03-21.md | 3 +++ tools/anime_pipeline.py | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 docs/devlog/2026-03-21.md 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에서 기존 정보 사용