Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
fixes
Murtaza Nasir87e4c2af0999
diff --git a/static/js/app.js b/static/js/app.jsindex 67e1e39f..3c1e2021 100644--- a/static/js/app.js+++ b/static/js/app.js@@ -231,13 +231,16 @@ document.addEventListener('DOMContentLoaded', () => {const wasDiarized = transcriptionData.some(segment => segment.speaker);if (!wasDiarized) {- const plainText = transcriptionData.map(segment => segment.sentence).join('\n');+ const segments = transcriptionData.map(segment => ({+ sentence: segment.sentence,+ startTime: segment.start_time,+ }));return {hasDialogue: false,- isJson: false, // Treat as plain text for rendering- content: plainText,+ isJson: true,+ content: segments.map(s => s.sentence).join('\n'),+ simpleSegments: segments,speakers: [],- simpleSegments: [],bubbleRows: []};}@@ -2226,17 +2229,19 @@ document.addEventListener('DOMContentLoaded', () => {try {const transcriptionData = JSON.parse(selectedRecording.value.transcription);if (Array.isArray(transcriptionData)) {- // It's our simplified JSON, format it for copying- textToCopy = transcriptionData.map(segment => {- const speakerName = speakerMap.value[segment.speaker]?.name || segment.speaker;- return `[${speakerName}]: ${segment.sentence}`;- }).join('\n');+ const wasDiarized = transcriptionData.some(segment => segment.speaker);+ if (wasDiarized) {+ textToCopy = transcriptionData.map(segment => {+ const speakerName = speakerMap.value[segment.speaker]?.name || segment.speaker;+ return `[${speakerName}]: ${segment.sentence}`;+ }).join('\n');+ } else {+ textToCopy = transcriptionData.map(segment => segment.sentence).join('\n');+ }} else {- // It's some other JSON or plain text, copy as istextToCopy = selectedRecording.value.transcription;}} catch (e) {- // Not JSON, so it's plain texttextToCopy = selectedRecording.value.transcription;}diff --git a/templates/index.html b/templates/index.htmlindex a4284471..301758f0 100644--- a/templates/index.html+++ b/templates/index.html@@ -555,7 +555,16 @@</div></div></div>- <pre v-else class="whitespace-pre-wrap font-sans">${ processedTranscription.content || 'No transcription available.' }</pre>+ <div v-else @click="seekAudioFromEvent">+ <div v-if="processedTranscription.simpleSegments && processedTranscription.simpleSegments.length > 0">+ <div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index"+ class="cursor-pointer hover:bg-[var(--bg-tertiary)] p-1 rounded"+ :data-start-time="segment.startTime">+ <span>${ segment.sentence }</span>+ </div>+ </div>+ <pre v-else class="whitespace-pre-wrap font-sans">${ processedTranscription.content || 'No transcription available.' }</pre>+ </div></div><div v-else-if="selectedRecording.status === 'FAILED'" class="text-[var(--text-danger)]"><p class="font-medium mb-2">Processing Failed:</p>@@ -1010,7 +1019,16 @@</div></div></div>- <pre v-else class="whitespace-pre-wrap font-sans">${ processedTranscription.content || 'No transcription available.' }</pre>+ <div v-else @click="seekAudioFromEvent">+ <div v-if="processedTranscription.simpleSegments && processedTranscription.simpleSegments.length > 0">+ <div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index"+ class="cursor-pointer hover:bg-[var(--bg-tertiary)] p-1 rounded"+ :data-start-time="segment.startTime">+ <span>${ segment.sentence }</span>+ </div>+ </div>+ <pre v-else class="whitespace-pre-wrap font-sans">${ processedTranscription.content || 'No transcription available.' }</pre>+ </div></div><div v-else-if="selectedRecording.status === 'FAILED'" class="text-[var(--text-danger)]"><p class="font-medium mb-2">Processing Failed:</p>