actors the i dont know xD

This commit is contained in:
Lars Behrends
2025-11-07 13:20:48 +01:00
parent 5d86fcfda9
commit 3f2f80de11
10 changed files with 602 additions and 135 deletions

View File

@@ -0,0 +1,63 @@
<?php
require_once __DIR__ . '/vendor/autoload.php';
try {
echo "=== Sync Existing Performers with Stash ===\n";
$config = require __DIR__ . '/config/database.php';
\App\Database\Database::setConfig($config);
$pdo = \App\Database\Database::getInstance();
// Get Stash configuration from database
$stmt = $pdo->prepare('SELECT * FROM sources WHERE name = ?');
$stmt->execute(['stash']);
$stashSource = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$stashSource) {
echo "ERROR: Stash source not configured in database\n";
exit(1);
}
echo "Found Stash configuration: {$stashSource['display_name']}\n";
// Create Stash sync service
$stashSyncService = new \App\Services\StashSyncService($pdo, $stashSource);
// Run the existing performers sync
echo "Starting sync of existing performers...\n";
$results = $stashSyncService->syncExistingPerformers();
echo "\n=== Sync Results ===\n";
echo "Processed: {$results['processed']} performers\n";
echo "Updated: {$results['updated']} performers\n";
echo "Skipped: {$results['skipped']} performers\n";
echo "Not found in Stash: " . count($results['not_found_in_stash']) . " performers\n";
echo "Errors: " . count($results['errors']) . " performers\n";
if (!empty($results['not_found_in_stash'])) {
echo "\n=== Actors Not Found in Stash ===\n";
echo "These actors exist in your local database but were not found in Stash.\n";
echo "You can create them in Stash for future syncs.\n\n";
foreach ($results['not_found_in_stash'] as $missingActor) {
echo "- {$missingActor['name']} (ID: {$missingActor['id']})\n";
}
echo "\nA detailed report has been saved to storage/logs/\n";
}
if (!empty($results['errors'])) {
echo "\n=== Errors ===\n";
foreach ($results['errors'] as $error) {
echo "- {$error}\n";
}
}
echo "\nSync completed successfully!\n";
} catch (Exception $e) {
echo "ERROR: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
exit(1);
}