@@ -98,13 +98,33 @@ class TVSeriesProcessor:
|
||||
"""Find all episodes on disk, grouped by (season, episode)"""
|
||||
episodes = {}
|
||||
|
||||
try:
|
||||
_log("DEBUG", f"Scanning for season directories in: {series_path}")
|
||||
_log("DEBUG", f"Series path exists: {series_path.exists()}, is_dir: {series_path.is_dir()}")
|
||||
|
||||
if not series_path.exists() or not series_path.is_dir():
|
||||
_log("ERROR", f"Series path does not exist or is not a directory: {series_path}")
|
||||
return episodes
|
||||
|
||||
# List all items in directory for debugging
|
||||
try:
|
||||
items = list(series_path.iterdir())
|
||||
_log("DEBUG", f"Found {len(items)} items in series directory")
|
||||
for item in items:
|
||||
_log("DEBUG", f" Item: {item.name} (is_dir: {item.is_dir()})")
|
||||
except Exception as e:
|
||||
_log("ERROR", f"Failed to list directory contents: {e}")
|
||||
return episodes
|
||||
|
||||
for season_dir in series_path.iterdir():
|
||||
_log("DEBUG", f"Checking directory: {season_dir.name} (is_dir: {season_dir.is_dir()})")
|
||||
_log("DEBUG", f"Season directory regex test for '{season_dir.name}': {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)
|
||||
_log("DEBUG", f"Found season directory: {season_dir.name} → season {season_num}")
|
||||
if season_num is None:
|
||||
_log("WARNING", f"Could not extract season number from: {season_dir.name}")
|
||||
continue
|
||||
|
||||
# Find video files in this season
|
||||
@@ -123,6 +143,10 @@ class TVSeriesProcessor:
|
||||
_log("DEBUG", f"Total episodes found on disk: {len(episodes)}")
|
||||
return episodes
|
||||
|
||||
except Exception as e:
|
||||
_log("ERROR", f"Exception in _find_episodes_on_disk: {e}")
|
||||
return episodes
|
||||
|
||||
def _extract_season_number(self, dirname: str) -> Optional[int]:
|
||||
"""Extract season number from directory name"""
|
||||
match = re.search(r'[Ss]eason\s+(\d+)', dirname, re.IGNORECASE)
|
||||
|
||||
Reference in New Issue
Block a user