fixed: recan issues

This commit is contained in:
2025-10-26 19:14:11 +01:00
parent 12688b9770
commit 75aa410f98
14 changed files with 37 additions and 666 deletions

View File

@@ -239,15 +239,15 @@ async def trigger_rescan(
_auth: dict = Depends(require_auth),
series_app: Any = Depends(get_series_app),
) -> dict:
"""Kick off a background rescan of the local library.
"""Kick off a rescan of the local library.
Args:
_auth: Ensures the caller is authenticated (value unused)
series_app: Core `SeriesApp` instance provided via dependency.
Returns:
Dict[str, Any]: Status payload communicating whether the rescan
launched successfully.
Dict[str, Any]: Status payload with scan results including
number of series found.
Raises:
HTTPException: If the rescan command is unsupported or fails.
@@ -255,8 +255,23 @@ async def trigger_rescan(
try:
# SeriesApp.ReScan expects a callback; pass a no-op
if hasattr(series_app, "ReScan"):
series_app.ReScan(lambda *args, **kwargs: None)
return {"success": True, "message": "Rescan started"}
result = series_app.ReScan(lambda *args, **kwargs: None)
if result.success:
series_count = (
result.data.get("series_count", 0)
if result.data else 0
)
return {
"success": True,
"message": result.message,
"series_count": series_count
}
else:
return {
"success": False,
"message": result.message
}
raise HTTPException(
status_code=status.HTTP_501_NOT_IMPLEMENTED,