Add transcript.md download option to help menu

This commit is contained in:
yair
2026-01-19 16:47:18 +02:00
parent 2144e3dd6b
commit 39800ad473
4 changed files with 45 additions and 0 deletions

28
app.js
View File

@@ -32,6 +32,7 @@ const embeddedWaveformOverlayCtx = embeddedWaveformOverlay ? embeddedWaveformOve
// Use values from config.js
const transcriptPath = CONFIG.transcript_path;
const waveformPath = CONFIG.waveform_path;
const markdownPath = CONFIG.markdown_path;
const START_OFFSET_SECONDS = CONFIG.start_offset_seconds;
const SPEAKER_LABELS = CONFIG.speaker_labels;
const palette = CONFIG.palette;
@@ -905,6 +906,33 @@ async function init() {
});
}
// Download transcript.md handler
const downloadTranscript = document.getElementById("downloadTranscript");
if (downloadTranscript) {
downloadTranscript.addEventListener("click", async (event) => {
event.preventDefault();
try {
const response = await fetch(markdownPath);
if (!response.ok) {
throw new Error(`Transcript not found: ${markdownPath}`);
}
const text = await response.text();
const blob = new Blob([text], { type: "text/markdown" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "transcript.md";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
} catch (err) {
console.error("Failed to download transcript:", err.message);
alert("Transcript file not available.");
}
});
}
// Close panels when clicking outside
window.addEventListener("click", (event) => {
if (configPanel && !configPanel.contains(event.target) && !configToggle.contains(event.target)) {

View File

@@ -93,6 +93,7 @@ const CONFIG = {
CONFIG.audio_path = `${CONFIG.input_dir}/${CONFIG.meeting_name}/${CONFIG.meeting_name}${CONFIG.audio_extension}`;
CONFIG.transcript_path = `${CONFIG.output_dir}/${CONFIG.output_format}/${CONFIG.meeting_name}/${CONFIG.meeting_name}.json`;
CONFIG.waveform_path = `${CONFIG.output_dir}/${CONFIG.output_format}/${CONFIG.meeting_name}/${CONFIG.meeting_name}.waveform.json`;
CONFIG.markdown_path = `${CONFIG.output_dir}/${CONFIG.output_format}/${CONFIG.meeting_name}/transcript.md`;
// Export for use in app.js
if (typeof module !== 'undefined' && module.exports) {

View File

@@ -24,6 +24,10 @@
<div class="help-item">Auto-updates on seek</div>
<div class="menu-title">Speakers</div>
<div class="help-item">Click bubble → next phrase</div>
<div class="menu-title">Download</div>
<div class="help-item">
<a href="#" id="downloadTranscript" class="download-link">📄 Transcript (.md)</a>
</div>
<div class="menu-footer">
<a href="https://git.telavivmakers.space/tami/space-talkers" target="_blank" rel="noopener">Source Code</a>
</div>

View File

@@ -291,6 +291,18 @@ body {
margin-right: 2px;
}
.download-link {
color: var(--glow);
text-decoration: none;
cursor: pointer;
transition: color 0.2s ease;
}
.download-link:hover {
color: #fff;
text-decoration: underline;
}
.menu-footer a {
color: var(--steel);
text-decoration: none;