Add NFO scan endpoint and fix scheduler test payload
- Implement /api/nfo/scan endpoint returning scan results - Fix Robot Framework scheduler test: use Evaluate+json.loads instead of Create Dictionary for nested data - Remove completed task docs
This commit is contained in:
@@ -16,6 +16,7 @@ from src.server.models.nfo import (
|
||||
NfoSettingsResponse,
|
||||
)
|
||||
from src.server.services.anime_service import AnimeService
|
||||
from src.server.services.nfo_scan_service import get_nfo_scan_service
|
||||
from src.server.utils.dependencies import get_anime_service, require_auth
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -531,3 +532,36 @@ async def batch_repair_nfo(
|
||||
results["errors"].append(f"{key}: {str(exc)}")
|
||||
|
||||
return results
|
||||
|
||||
|
||||
class NfoScanResponse(BaseModel):
|
||||
"""Response for the NFO scan endpoint."""
|
||||
|
||||
total: int
|
||||
created: int
|
||||
updated: int
|
||||
errors_count: int
|
||||
scan_id: str
|
||||
duration_seconds: float
|
||||
|
||||
|
||||
@router.post("/scan", response_model=NfoScanResponse)
|
||||
async def scan_nfo(
|
||||
_auth: dict = Depends(require_auth),
|
||||
anime_service: AnimeService = Depends(get_anime_service),
|
||||
) -> NfoScanResponse:
|
||||
"""Run an NFO scan across all series.
|
||||
|
||||
Triggers validation and creation of tvshow.nfo files for all series
|
||||
in the anime library.
|
||||
|
||||
Args:
|
||||
_auth: Authentication dependency
|
||||
anime_service: AnimeService dependency
|
||||
|
||||
Returns:
|
||||
NfoScanResponse with summary of scan results
|
||||
"""
|
||||
nfo_scan_service = get_nfo_scan_service()
|
||||
result = await nfo_scan_service.scan_all(anime_service)
|
||||
return NfoScanResponse(**result)
|
||||
|
||||
Reference in New Issue
Block a user