mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-17 23:41:28 +00:00
Make caption startup responsive
This commit is contained in:
@@ -363,20 +363,29 @@
|
|||||||
$('captionFrames').textContent = (s.frames_completed || 0) + ' / ' + (s.frames_total || 0) + ' frames';
|
$('captionFrames').textContent = (s.frames_completed || 0) + ' / ' + (s.frames_total || 0) + ' frames';
|
||||||
|
|
||||||
if (s.running) {
|
if (s.running) {
|
||||||
|
const starting = s.stage === 'starting';
|
||||||
const syncing = s.stage === 'syncing' || s.stage === 'sync';
|
const syncing = s.stage === 'syncing' || s.stage === 'sync';
|
||||||
const stopping = !!s.stop_requested;
|
const stopping = !!s.stop_requested;
|
||||||
$('captionNow').disabled = syncing || stopping;
|
$('captionNow').disabled = starting || syncing || stopping;
|
||||||
$('captionNow').textContent = syncing
|
$('captionNow').textContent = starting
|
||||||
? 'Finishing...'
|
? 'Starting...'
|
||||||
: (stopping
|
: (syncing
|
||||||
? 'Stopping...'
|
? 'Finishing...'
|
||||||
: ((s.paused || s.pause_requested) ? 'Resume' : 'Pause'));
|
: (stopping
|
||||||
|
? 'Stopping...'
|
||||||
|
: ((s.paused || s.pause_requested) ? 'Resume' : 'Pause')));
|
||||||
$('captionStop').disabled = syncing || stopping;
|
$('captionStop').disabled = syncing || stopping;
|
||||||
$('forceCaption').disabled = true;
|
$('forceCaption').disabled = true;
|
||||||
$('captionStatus').className = 'status';
|
$('captionStatus').className = 'status';
|
||||||
if (stopping) {
|
if (stopping) {
|
||||||
$('captionStatus').textContent = 'Stop requested; finishing the current frame';
|
$('captionStatus').textContent = starting
|
||||||
|
? 'Stop requested; finishing preparation'
|
||||||
|
: 'Stop requested; finishing the current frame';
|
||||||
$('captionDetail').textContent = s.title || '';
|
$('captionDetail').textContent = s.title || '';
|
||||||
|
} else if (starting) {
|
||||||
|
$('captionStatus').textContent = 'Starting captioning';
|
||||||
|
$('captionDetail').textContent =
|
||||||
|
s.preparing || 'Preparing caption job...';
|
||||||
} else if (s.paused) {
|
} else if (s.paused) {
|
||||||
$('captionStatus').textContent = 'Captioning paused';
|
$('captionStatus').textContent = 'Captioning paused';
|
||||||
$('captionDetail').textContent =
|
$('captionDetail').textContent =
|
||||||
@@ -465,6 +474,14 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
$('captionNow').disabled = true;
|
||||||
|
$('captionNow').textContent = 'Starting...';
|
||||||
|
$('captionStop').disabled = true;
|
||||||
|
$('forceCaption').disabled = true;
|
||||||
|
$('captionStatus').className = 'status';
|
||||||
|
$('captionStatus').textContent = 'Starting captioning';
|
||||||
|
$('captionDetail').textContent = 'Sending start request...';
|
||||||
|
|
||||||
const s = await api('/api/caption', {
|
const s = await api('/api/caption', {
|
||||||
method:'POST',
|
method:'POST',
|
||||||
body:JSON.stringify({library_ids:ids, force:$('forceCaption').checked})
|
body:JSON.stringify({library_ids:ids, force:$('forceCaption').checked})
|
||||||
|
|||||||
Reference in New Issue
Block a user