Files
MediaCollectorLibary/view_missing_actors.php
2025-11-07 13:20:48 +01:00

76 lines
2.4 KiB
PHP

<?php
require_once __DIR__ . '/vendor/autoload.php';
try {
echo "=== View Missing Stash Actors Reports ===\n";
$logDir = __DIR__ . '/storage/logs';
if (!is_dir($logDir)) {
echo "No logs directory found. Run the sync first to generate reports.\n";
exit(0);
}
$files = glob($logDir . '/missing_stash_actors_*.json');
if (empty($files)) {
echo "No missing actors reports found. Run the sync script first.\n";
exit(0);
}
echo "Found " . count($files) . " report(s):\n\n";
// Sort by date (newest first)
usort($files, function($a, $b) {
return filemtime($b) <=> 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);
}