diff --git a/scene_search/web/index.html b/scene_search/web/index.html index 68b29b9..416d9cc 100644 --- a/scene_search/web/index.html +++ b/scene_search/web/index.html @@ -363,20 +363,29 @@ $('captionFrames').textContent = (s.frames_completed || 0) + ' / ' + (s.frames_total || 0) + ' frames'; if (s.running) { + const starting = s.stage === 'starting'; const syncing = s.stage === 'syncing' || s.stage === 'sync'; const stopping = !!s.stop_requested; - $('captionNow').disabled = syncing || stopping; - $('captionNow').textContent = syncing - ? 'Finishing...' - : (stopping - ? 'Stopping...' - : ((s.paused || s.pause_requested) ? 'Resume' : 'Pause')); + $('captionNow').disabled = starting || syncing || stopping; + $('captionNow').textContent = starting + ? 'Starting...' + : (syncing + ? 'Finishing...' + : (stopping + ? 'Stopping...' + : ((s.paused || s.pause_requested) ? 'Resume' : 'Pause'))); $('captionStop').disabled = syncing || stopping; $('forceCaption').disabled = true; $('captionStatus').className = 'status'; 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 || ''; + } else if (starting) { + $('captionStatus').textContent = 'Starting captioning'; + $('captionDetail').textContent = + s.preparing || 'Preparing caption job...'; } else if (s.paused) { $('captionStatus').textContent = 'Captioning paused'; $('captionDetail').textContent = @@ -465,6 +474,14 @@ return; } 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', { method:'POST', body:JSON.stringify({library_ids:ids, force:$('forceCaption').checked})