filemtime($a); }); foreach ($files as $index => $file) { $filename = basename($file); $fileData = json_decode(file_get_contents($file), true); if (!$fileData) { echo "ERROR: Could not read report file: {$filename}\n"; continue; } echo "Report #" . ($index + 1) . ": {$filename}\n"; echo "Generated: " . ($fileData['generated_at'] ?? 'Unknown') . "\n"; echo "Total Missing Actors: " . ($fileData['total_missing'] ?? 0) . "\n"; if (!empty($fileData['description'])) { echo "Description: " . $fileData['description'] . "\n"; } if (!empty($fileData['missing_actors'])) { echo "\nMissing Actors:\n"; foreach ($fileData['missing_actors'] as $actor) { echo " - {$actor['name']} (ID: {$actor['id']})\n"; // Show some local metadata if available $localMeta = $actor['local_metadata'] ?? []; if (!empty($localMeta['birth_date'])) { echo " Birth Date: {$localMeta['birth_date']}\n"; } if (!empty($localMeta['nationality'])) { echo " Nationality: {$localMeta['nationality']}\n"; } if (!empty($localMeta['gender'])) { echo " Gender: {$localMeta['gender']}\n"; } echo "\n"; } } echo str_repeat("-", 50) . "\n\n"; } echo "To create these actors in Stash, use the data above to manually add them.\n"; echo "After creating them in Stash, run the sync again to match them up.\n"; } catch (Exception $e) { echo "ERROR: " . $e->getMessage() . "\n"; exit(1); }