debug: Add extensive logging for episode detection
Local Docker Build (Dev) / build-dev (push) Successful in 29s
Local Docker Build (Dev) / build-dev (push) Successful in 29s
Added detailed debug logging to diagnose why High Potential shows "0 episodes" despite having video files: - Log season directory detection and pattern matching - Log video file scanning and episode filename parsing - Log season number extraction and matching logic - Log final episode count and processing decisions This will help identify where the episode detection is failing in the pipeline. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,23 +19,29 @@ class EpisodeNFOManager:
|
|||||||
def find_video_files_for_season(self, season_dir: Path) -> Dict[Tuple[int, int], List[Path]]:
|
def find_video_files_for_season(self, season_dir: Path) -> Dict[Tuple[int, int], List[Path]]:
|
||||||
"""Find all video files in season directory, grouped by (season, episode)"""
|
"""Find all video files in season directory, grouped by (season, episode)"""
|
||||||
if not season_dir.exists():
|
if not season_dir.exists():
|
||||||
|
_log("DEBUG", f"Season directory does not exist: {season_dir}")
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
video_extensions = [".mkv", ".mp4", ".avi", ".mov", ".m4v"]
|
video_extensions = [".mkv", ".mp4", ".avi", ".mov", ".m4v"]
|
||||||
episodes = {}
|
episodes = {}
|
||||||
|
|
||||||
|
_log("DEBUG", f"Scanning video files in: {season_dir}")
|
||||||
for video_file in season_dir.iterdir():
|
for video_file in season_dir.iterdir():
|
||||||
|
_log("DEBUG", f"Checking file: {video_file.name} (is_file: {video_file.is_file()}, suffix: {video_file.suffix.lower()})")
|
||||||
if (video_file.is_file() and
|
if (video_file.is_file() and
|
||||||
video_file.suffix.lower() in video_extensions):
|
video_file.suffix.lower() in video_extensions):
|
||||||
|
|
||||||
episode_info = self._parse_episode_from_filename(video_file.name)
|
episode_info = self._parse_episode_from_filename(video_file.name)
|
||||||
|
_log("DEBUG", f"Episode parsing for '{video_file.name}': {episode_info}")
|
||||||
if episode_info:
|
if episode_info:
|
||||||
season_num, episode_num = episode_info
|
season_num, episode_num = episode_info
|
||||||
key = (season_num, episode_num)
|
key = (season_num, episode_num)
|
||||||
if key not in episodes:
|
if key not in episodes:
|
||||||
episodes[key] = []
|
episodes[key] = []
|
||||||
episodes[key].append(video_file)
|
episodes[key].append(video_file)
|
||||||
|
_log("DEBUG", f"Added video file: S{season_num:02d}E{episode_num:02d} → {video_file.name}")
|
||||||
|
|
||||||
|
_log("DEBUG", f"Total video files found: {len(episodes)} episodes")
|
||||||
return episodes
|
return episodes
|
||||||
|
|
||||||
def _parse_episode_from_filename(self, filename: str) -> Optional[Tuple[int, int]]:
|
def _parse_episode_from_filename(self, filename: str) -> Optional[Tuple[int, int]]:
|
||||||
|
|||||||
@@ -98,20 +98,29 @@ class TVSeriesProcessor:
|
|||||||
"""Find all episodes on disk, grouped by (season, episode)"""
|
"""Find all episodes on disk, grouped by (season, episode)"""
|
||||||
episodes = {}
|
episodes = {}
|
||||||
|
|
||||||
|
_log("DEBUG", f"Scanning for season directories in: {series_path}")
|
||||||
for season_dir in series_path.iterdir():
|
for season_dir in series_path.iterdir():
|
||||||
|
_log("DEBUG", f"Checking directory: {season_dir.name} (is_dir: {season_dir.is_dir()})")
|
||||||
if season_dir.is_dir() and self._is_season_directory(season_dir.name):
|
if season_dir.is_dir() and self._is_season_directory(season_dir.name):
|
||||||
season_num = self._extract_season_number(season_dir.name)
|
season_num = self._extract_season_number(season_dir.name)
|
||||||
|
_log("DEBUG", f"Found season directory: {season_dir.name} → season {season_num}")
|
||||||
if season_num is None:
|
if season_num is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Find video files in this season
|
# Find video files in this season
|
||||||
season_episodes = self.episode_nfo_manager.find_video_files_for_season(season_dir)
|
season_episodes = self.episode_nfo_manager.find_video_files_for_season(season_dir)
|
||||||
|
_log("DEBUG", f"Found {len(season_episodes)} episodes in {season_dir.name}: {list(season_episodes.keys())}")
|
||||||
|
|
||||||
# Add season directory info to episodes
|
# Add season directory info to episodes
|
||||||
for (s_num, e_num), video_files in season_episodes.items():
|
for (s_num, e_num), video_files in season_episodes.items():
|
||||||
|
_log("DEBUG", f"Episode S{s_num:02d}E{e_num:02d}: season_dir={season_num}, filename_season={s_num}")
|
||||||
if s_num == season_num: # Verify season matches directory
|
if s_num == season_num: # Verify season matches directory
|
||||||
episodes[(s_num, e_num)] = video_files
|
episodes[(s_num, e_num)] = video_files
|
||||||
|
_log("DEBUG", f"Added episode S{s_num:02d}E{e_num:02d} to processing list")
|
||||||
|
else:
|
||||||
|
_log("WARNING", f"Season mismatch: directory={season_num}, filename={s_num} for S{s_num:02d}E{e_num:02d}")
|
||||||
|
|
||||||
|
_log("DEBUG", f"Total episodes found on disk: {len(episodes)}")
|
||||||
return episodes
|
return episodes
|
||||||
|
|
||||||
def _extract_season_number(self, dirname: str) -> Optional[int]:
|
def _extract_season_number(self, dirname: str) -> Optional[int]:
|
||||||
|
|||||||
Reference in New Issue
Block a user