improvments: updates to scans etc

This commit is contained in:
2025-10-27 09:25:47 -04:00
parent 2eda166328
commit c6a8cce509
3 changed files with 83 additions and 10 deletions
+19 -6
View File
@@ -804,7 +804,9 @@ async def manual_scan(background_tasks: BackgroundTasks, path: Optional[str] = N
if path and scan_path.name.lower().startswith('season'):
# Single season processing
series_path = scan_path.parent
if nfo_manager.parse_imdb_from_path(series_path):
tv_processor_obj = dependencies.get("tv_processor")
sonarr_client = tv_processor_obj.sonarr if tv_processor_obj and hasattr(tv_processor_obj, 'sonarr') else None
if nfo_manager.parse_imdb_from_path_with_nfo_fallback(series_path, sonarr_client):
print(f"INFO: Processing single season: {scan_path}")
try:
tv_processor.process_season(series_path, scan_path)
@@ -814,15 +816,19 @@ async def manual_scan(background_tasks: BackgroundTasks, path: Optional[str] = N
# Single episode processing
season_path = scan_path.parent
series_path = season_path.parent
if nfo_manager.parse_imdb_from_path(series_path):
tv_processor_obj = dependencies.get("tv_processor")
sonarr_client = tv_processor_obj.sonarr if tv_processor_obj and hasattr(tv_processor_obj, 'sonarr') else None
if nfo_manager.parse_imdb_from_path_with_nfo_fallback(series_path, sonarr_client):
print(f"INFO: Processing single episode: {scan_path}")
try:
tv_processor.process_episode_file(series_path, season_path, scan_path)
except Exception as e:
print(f"ERROR: Failed processing episode {scan_path}: {e}")
else:
# Check if this path itself is a series (has IMDb ID in the directory name)
if nfo_manager.parse_imdb_from_path(scan_path):
# Check if this path itself is a series (has IMDb ID in directory name or NFO files)
tv_processor_obj = dependencies.get("tv_processor")
sonarr_client = tv_processor_obj.sonarr if tv_processor_obj and hasattr(tv_processor_obj, 'sonarr') else None
if nfo_manager.parse_imdb_from_path_with_nfo_fallback(scan_path, sonarr_client):
try:
# Determine force_scan based on scan mode
force_scan = (scan_mode == "full")
@@ -846,8 +852,10 @@ async def manual_scan(background_tasks: BackgroundTasks, path: Optional[str] = N
not item.name.lower().startswith('season') and
not re.match(r'^season\s+\d+$', item.name, re.IGNORECASE)):
# Check for IMDb ID
imdb_id = nfo_manager.parse_imdb_from_path(item)
# Check for IMDb ID (enhanced with NFO fallback)
tv_processor_obj = dependencies.get("tv_processor")
sonarr_client = tv_processor_obj.sonarr if tv_processor_obj and hasattr(tv_processor_obj, 'sonarr') else None
imdb_id = nfo_manager.parse_imdb_from_path_with_nfo_fallback(item, sonarr_client)
if imdb_id:
tv_series_list.append(item)
else:
@@ -2201,6 +2209,11 @@ def register_routes(app, dependencies: dict):
@app.get("/health")
async def _health() -> HealthResponse:
return await health(dependencies)
@app.get("/health/simple")
async def _health_simple():
"""Simple health check for Docker without external dependencies"""
return {"status": "healthy", "service": "nfoguard-core"}
@app.get("/stats")
async def _get_stats():