xbvr sync

This commit is contained in:
Lars Behrends
2025-11-14 02:42:44 +01:00
parent aed9d87c5c
commit 1b053148f0
12 changed files with 2035 additions and 1086 deletions

View File

@@ -57,6 +57,45 @@ class StashSyncService extends BaseSyncService
$this->logProgress("Processed {$this->processedCount} Stash items");
}
/**
* Check if a scene should be ignored based on file paths and ignore patterns in config
*/
private function shouldIgnoreScene(array $sceneData): bool
{
$config = $this->source['config'] ?? null;
if (empty($config)) {
return false;
}
$configData = json_decode($config, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$this->logProgress('Invalid JSON in source config, skipping ignore check');
return false;
}
$ignorePaths = $configData['ignore_paths'] ?? [];
if (empty($ignorePaths) || !is_array($ignorePaths)) {
return false;
}
$files = $sceneData['files'] ?? [];
foreach ($files as $file) {
$filePath = $file['path'] ?? '';
if (empty($filePath)) {
continue;
}
foreach ($ignorePaths as $ignorePattern) {
if (stripos($filePath, $ignorePattern) !== false) {
$this->logProgress("Scene '{$sceneData['title']}' ignored due to file path containing: '{$ignorePattern}'");
return true;
}
}
}
return false;
}
private function syncScenes(): void
{
try {
@@ -91,6 +130,20 @@ class StashSyncService extends BaseSyncService
foreach ($scenes as $sceneData) {
try {
$this->logProgress("Processing scene: {$sceneData['title']} (ID: {$sceneData['id']})");
// Check if scene should be ignored based on file paths
if ($this->shouldIgnoreScene($sceneData)) {
$this->processedCount++; // Still count as processed
// Update progress for ignored items
$this->updateSyncLog($this->currentSyncLogId, 'running', [
'processed_items' => $this->processedCount,
'new_items' => $this->newCount,
'updated_items' => $this->updatedCount,
'message' => "Processed {$this->processedCount} of ~{$totalCount} scenes (ignored)"
]);
continue;
}
$this->syncScene($sceneData);
$this->processedCount++;
@@ -210,6 +263,7 @@ class StashSyncService extends BaseSyncService
audio_codec
width
height
path
}
performers {
id