mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
actor sync
This commit is contained in:
@@ -85,6 +85,28 @@
|
||||
Cleanup
|
||||
</button>
|
||||
</div>
|
||||
{% elseif source.name == 'stash' %}
|
||||
<!-- Stash-specific sync options -->
|
||||
<div class="d-flex gap-2 mb-2">
|
||||
<button onclick="startSync({{ source.id }}, 'full')"
|
||||
class="btn btn-primary btn-sm flex-fill"
|
||||
data-source-id="{{ source.id }}">
|
||||
Full Sync
|
||||
</button>
|
||||
<button onclick="startSync({{ source.id }}, 'incremental')"
|
||||
class="btn btn-secondary btn-sm flex-fill"
|
||||
data-source-id="{{ source.id }}">
|
||||
Incremental
|
||||
</button>
|
||||
</div>
|
||||
<!-- Stash Performer Sync Button -->
|
||||
<div class="mb-2">
|
||||
<button onclick="syncStashPerformers()"
|
||||
class="btn btn-info btn-sm w-100"
|
||||
id="stash-performer-sync-btn">
|
||||
<i class="bi bi-person-lines-fill me-1"></i>Sync Performers
|
||||
</button>
|
||||
</div>
|
||||
{% else %}
|
||||
<!-- Standard sync options for other sources -->
|
||||
<div class="d-flex gap-2 mb-2">
|
||||
@@ -487,6 +509,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
function syncStashPerformers() {
|
||||
const button = document.getElementById('stash-performer-sync-btn');
|
||||
const originalText = button.innerHTML;
|
||||
|
||||
// Show loading state
|
||||
button.disabled = true;
|
||||
button.innerHTML = '<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>Syncing...';
|
||||
|
||||
// Make AJAX request to sync performers
|
||||
fetch('/api/actors/sync-existing-stash', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.getAttribute('content')
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
alert(`Stash performer sync completed!\n\nProcessed: ${data.results.processed}\nUpdated: ${data.results.updated}\nSkipped: ${data.results.skipped}\nNot found in Stash: ${data.results.not_found_in_stash.length}\n\nCheck the logs for detailed information.`);
|
||||
} else {
|
||||
alert('Error syncing performers: ' + (data.error || 'Unknown error'));
|
||||
}
|
||||
|
||||
// Re-enable button
|
||||
button.disabled = false;
|
||||
button.innerHTML = originalText;
|
||||
})
|
||||
.catch(error => {
|
||||
alert('Failed to sync performers: ' + error.message);
|
||||
|
||||
// Re-enable button
|
||||
button.disabled = false;
|
||||
button.innerHTML = originalText;
|
||||
});
|
||||
}
|
||||
|
||||
// Cleanup intervals on page unload
|
||||
window.addEventListener('beforeunload', () => {
|
||||
Object.values(syncIntervals).forEach(interval => clearInterval(interval));
|
||||
|
||||
Reference in New Issue
Block a user