mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
xbvr sync
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user