fixed: recan issues
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -924,15 +924,28 @@ class AniWorldApp {
|
||||
|
||||
async rescanSeries() {
|
||||
try {
|
||||
this.showToast('Scanning directory...', 'info');
|
||||
|
||||
const response = await this.makeAuthenticatedRequest('/api/anime/rescan', {
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
if (!response) return;
|
||||
const data = await response.json();
|
||||
|
||||
// Debug logging
|
||||
console.log('Rescan response:', data);
|
||||
console.log('Success value:', data.success, 'Type:', typeof data.success);
|
||||
|
||||
if (data.status === 'success') {
|
||||
this.showToast('Rescan started', 'success');
|
||||
if (data.success === true) {
|
||||
const seriesCount = data.series_count || 0;
|
||||
this.showToast(
|
||||
`Rescan complete! Found ${seriesCount} series with missing episodes.`,
|
||||
'success'
|
||||
);
|
||||
|
||||
// Reload the series list to show the updated data
|
||||
await this.loadSeries();
|
||||
} else {
|
||||
this.showToast(`Rescan error: ${data.message}`, 'error');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user