rescan the library, returns stats. require_once __DIR__ . '/../includes/auth.php'; require_once __DIR__ . '/../includes/functions.php'; header('Content-Type: application/json'); requireLoginApi(); if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); exit; } verifyCsrfApi(); try { echo json_encode(['ok' => true, 'stats' => scanLibrary()]); } catch (Throwable $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }