Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
rec status
Murtaza Nasirdcd9d664d258
diff --git a/app.py b/app.pyindex f7665eb6..80ce41fc 100644--- a/app.py+++ b/app.py@@ -1459,6 +1459,32 @@ JSON Response:"""app.logger.error(f"Error reprocessing summary for recording {recording_id}: {e}")return jsonify({'error': str(e)}), 500[email protected]('/recording/<int:recording_id>/reset_status', methods=['POST'])+@login_required+def reset_status(recording_id):+ """Resets the status of a stuck recording to FAILED."""+ try:+ recording = db.session.get(Recording, recording_id)+ if not recording:+ return jsonify({'error': 'Recording not found'}), 404++ if recording.user_id and recording.user_id != current_user.id:+ return jsonify({'error': 'You do not have permission to modify this recording'}), 403++ # Only allow resetting if it's stuck in a processing state+ if recording.status in ['PROCESSING', 'SUMMARIZING']:+ recording.status = 'FAILED'+ recording.summary = (recording.summary or "") + "\n\n[Manually reset from stuck state]"+ db.session.commit()+ app.logger.info(f"Manually reset status for recording {recording_id} to FAILED.")+ return jsonify({'success': True, 'message': 'Recording status has been reset.', 'recording': recording.to_dict()})+ else:+ return jsonify({'error': f'Recording is not in a processing state. Current status: {recording.status}'}), 400++ except Exception as e:+ db.session.rollback()+ app.logger.error(f"Error resetting status for recording {recording_id}: {e}")+ return jsonify({'error': str(e)}), 500# --- Authentication Routes ---@app.route('/register', methods=['GET', 'POST'])diff --git a/static/js/app.js b/static/js/app.jsindex 3c1e2021..36b10467 100644--- a/static/js/app.js+++ b/static/js/app.js@@ -39,9 +39,11 @@ document.addEventListener('DOMContentLoaded', () => {const showEditModal = ref(false);const showDeleteModal = ref(false);const showReprocessModal = ref(false);+ const showResetModal = ref(false);const showSpeakerModal = ref(false);const editingRecording = ref(null); // Holds a *copy* for the modalconst recordingToDelete = ref(null);+ const recordingToReset = ref(null);const reprocessType = ref(null); // 'transcription' or 'summary'const reprocessRecording = ref(null);const isAutoIdentifying = ref(false);@@ -2002,6 +2004,51 @@ document.addEventListener('DOMContentLoaded', () => {}};+ const confirmReset = (recording) => {+ recordingToReset.value = recording;+ showResetModal.value = true;+ };++ const cancelReset = () => {+ showResetModal.value = false;+ recordingToReset.value = null;+ };++ const executeReset = async () => {+ if (!recordingToReset.value) return;+ const recordingId = recordingToReset.value.id;++ // Close the modal first+ cancelReset();++ try {+ const response = await fetch(`/recording/${recordingId}/reset_status`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' }+ });++ const data = await response.json();+ if (!response.ok) throw new Error(data.error || 'Failed to reset status');++ // Update the recording in the UI+ const index = recordings.value.findIndex(r => r.id === recordingId);+ if (index !== -1) {+ recordings.value[index] = data.recording;+ }++ // Update selected recording if it's the one being reset+ if (selectedRecording.value?.id === recordingId) {+ selectedRecording.value = data.recording;+ }++ showToast('Recording status has been reset.', 'fa-check-circle');++ } catch (error) {+ console.error('Reset Status Error:', error);+ setGlobalError(`Failed to reset status: ${error.message}`);+ }+ };+// --- Chat functionality ---const showChat = ref(false);@@ -2367,7 +2414,7 @@ document.addEventListener('DOMContentLoaded', () => {return {// StatecurrentView, dragover, recordings, selectedRecording, // currentRecording removed- showEditModal, showDeleteModal, editingRecording, recordingToDelete,+ showEditModal, showDeleteModal, showResetModal, editingRecording, recordingToDelete, recordingToReset,isLoadingRecordings, globalError, maxFileSizeMB, isDarkMode, // <-- Added isDarkMode// Multi-upload StateuploadQueue, currentlyProcessingFile, processingProgress, processingMessage,@@ -2416,6 +2463,9 @@ document.addEventListener('DOMContentLoaded', () => {// ReprocessingreprocessTranscription,reprocessSummary,+ confirmReset,+ cancelReset,+ executeReset,showReprocessModal,reprocessType,reprocessRecording,diff --git a/templates/index.html b/templates/index.htmlindex 9e28e11a..255f5410 100644--- a/templates/index.html+++ b/templates/index.html@@ -233,6 +233,28 @@</div></div></div>+ <!-- Reset Status Confirmation Modal -->+ <div v-if="showResetModal" @click="cancelReset" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 p-4 backdrop-blur-sm">+ <div @click.stop class="bg-[var(--bg-secondary)] rounded-xl shadow-2xl w-full max-w-md">+ <div class="p-6 text-center">+ <div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-orange-100 dark:bg-orange-800 mb-4">+ <i class="fas fa-exclamation-triangle text-2xl text-orange-500 dark:text-orange-300"></i>+ </div>+ <h3 class="text-lg font-semibold text-[var(--text-primary)] mb-2">Reset Recording Status?</h3>+ <p class="text-sm text-[var(--text-muted)] mb-6">+ This will mark the recording as 'Failed'. This is useful if processing is stuck. You will be able to reprocess it afterwards.+ </p>+ </div>+ <div class="bg-[var(--bg-tertiary)] px-6 py-4 rounded-b-xl flex justify-end space-x-3">+ <button @click="cancelReset" class="px-4 py-2 bg-[var(--bg-secondary)] text-[var(--text-secondary)] rounded-lg border border-[var(--border-secondary)] hover:bg-[var(--bg-tertiary)]">+ Cancel+ </button>+ <button @click="executeReset" class="px-4 py-2 bg-orange-500 text-white rounded-lg hover:bg-orange-600">+ Yes, Reset Status+ </button>+ </div>+ </div>+ </div><!-- Speaker Identification Modal --><div v-if="showSpeakerModal" @click="closeSpeakerModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 p-4 backdrop-blur-sm"><div @click.stop class="bg-[var(--bg-secondary)] rounded-xl shadow-2xl w-full max-w-4xl flex flex-col max-h-[90vh]">@@ -430,6 +452,11 @@title="Reprocess summary"><i class="fas fa-sync-alt"></i></button>+ <button @click="confirmReset(selectedRecording)" v-if="selectedRecording && (selectedRecording.status === 'PROCESSING' || selectedRecording.status === 'SUMMARIZING')"+ class="p-2 rounded-md text-sm transition-all hover:scale-105 bg-orange-100 text-orange-600 hover:bg-orange-200 dark:bg-orange-700 dark:text-orange-200 dark:hover:bg-orange-600"+ title="Reset Stuck Status">+ <i class="fas fa-power-off"></i>+ </button><button @click="openSpeakerModal" v-if="identifiedSpeakers.length > 0"class="p-2 rounded-md text-sm transition-all hover:scale-105 bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"title="Identify Speakers">@@ -885,6 +912,11 @@title="Reprocess summary"><i class="fas fa-sync-alt"></i></button>+ <button @click="confirmReset(selectedRecording)" v-if="selectedRecording && (selectedRecording.status === 'PROCESSING' || selectedRecording.status === 'SUMMARIZING')"+ class="p-2 rounded-md text-sm transition-all hover:scale-105 bg-orange-100 text-orange-600 hover:bg-orange-200 dark:bg-orange-700 dark:text-orange-200 dark:hover:bg-orange-600"+ title="Reset Stuck Status">+ <i class="fas fa-power-off"></i>+ </button><button @click="openSpeakerModal" v-if="identifiedSpeakers.length > 0"class="p-2 rounded-md text-sm transition-all hover:scale-105 bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"title="Identify Speakers">