mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
actors the i dont know xD
This commit is contained in:
@@ -656,13 +656,32 @@ class StashSyncService extends BaseSyncService
|
||||
$name = $performer['name'] ?? '';
|
||||
if (empty($name)) return null;
|
||||
|
||||
// Check if actor already exists
|
||||
// Check if actor already exists by name or alias
|
||||
// First check by exact name
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT id, name, thumbnail_path, metadata FROM actors WHERE name = :name
|
||||
SELECT id, name, thumbnail_path, metadata FROM actors
|
||||
WHERE name = :name
|
||||
");
|
||||
$stmt->execute(['name' => $name]);
|
||||
$existingActor = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// If not found by name, check aliases in PHP
|
||||
if (!$existingActor) {
|
||||
$stmt = $this->pdo->prepare("SELECT id, name, thumbnail_path, metadata FROM actors");
|
||||
$stmt->execute();
|
||||
$allActors = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($allActors as $actor) {
|
||||
$metadata = json_decode($actor['metadata'] ?? '{}', true);
|
||||
$aliases = $metadata['aliases'] ?? [];
|
||||
if (is_array($aliases) && in_array($name, $aliases)) {
|
||||
$existingActor = $actor;
|
||||
$this->logProgress("Found existing actor '{$actor['name']}' by alias '{$name}'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare rich metadata from Stash performer data
|
||||
$actorMetadata = [
|
||||
'stash_id' => $performer['id'] ?? null,
|
||||
@@ -908,8 +927,9 @@ class StashSyncService extends BaseSyncService
|
||||
try {
|
||||
$this->logProgress('Starting existing performers sync with Stash...');
|
||||
|
||||
echo "Starting existing performers sync with Stash..\n";
|
||||
// Get all existing actors from database
|
||||
$stmt = $this->pdo->prepare("SELECT id, name, metadata FROM actors ORDER BY name ASC");
|
||||
$stmt = $this->pdo->prepare("SELECT id, name, metadata FROM actors WHERE id IN (SELECT actor_id FROM actor_adult_video) ORDER BY name ASC");
|
||||
$stmt->execute();
|
||||
$existingActors = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user