From 543ecf534b7cf928d7af865d3198622c87091789 Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:17:07 +0200 Subject: [PATCH 1/3] Return Transcription JSON on `handlePostTranscription` --- backend/api/handlers.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/api/handlers.go b/backend/api/handlers.go index ff877f1..586daa2 100644 --- a/backend/api/handlers.go +++ b/backend/api/handlers.go @@ -101,9 +101,20 @@ func (s *Server) handlePostTranscription(c *fiber.Ctx) error { return fiber.NewError(fiber.StatusInternalServerError, "Internal server error") } - // Write the JSON to the response body. + // Broadcast transcription to websocket clients s.BroadcastTranscription(res) s.NewTranscriptionCh <- true + + // Convert the transcription to JSON. + json, err := json.Marshal(res) + if err != nil { + // 503 On vacation! + return fiber.NewError(fiber.StatusServiceUnavailable, "On vacation!") + } + + // Write the JSON to the response body. + c.Set("Content-Type", "application/json") + c.Write(json) return nil } From e7a57e49cc1674a9a11a336cb959db63fbd825d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 7 Jan 2024 22:30:17 -0600 Subject: [PATCH 2/3] Update README.md Fix URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3678421..0d9d066 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Contributions are welcome! Feel free to open a PR with your changes, or take a l ### Development setup -Check out the development documentation [here](https://whishper.net/guides/development/). +Check out the development documentation [here](https://whishper.net/guides/develop/). ## Screenshots From 41b5dbdf854654f00d5821a932c6b34fbf2eeaeb Mon Sep 17 00:00:00 2001 From: pluja <64632615+pluja@users.noreply.github.com> Date: Tue, 30 Jan 2024 19:35:03 +0100 Subject: [PATCH 3/3] Fix #81 --- frontend/src/lib/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/utils.js b/frontend/src/lib/utils.js index a039cc2..3c3e117 100644 --- a/frontend/src/lib/utils.js +++ b/frontend/src/lib/utils.js @@ -102,13 +102,13 @@ export const downloadVTT = function (jsonData, title) { jsonData.forEach((segment, index) => { let startSeconds = Math.floor(segment.start); let startMillis = Math.floor((segment.start - startSeconds) * 1000); - let start = new Date(startSeconds * 1000 + startMillis).toISOString().substr(11, 12).replace('.', ','); + let start = new Date(startSeconds * 1000 + startMillis).toISOString().substr(11, 12); let endSeconds = Math.floor(segment.end); let endMillis = Math.floor((segment.end - endSeconds) * 1000); - let end = new Date(endSeconds * 1000 + endMillis).toISOString().substr(11, 12).replace('.', ','); + let end = new Date(endSeconds * 1000 + endMillis).toISOString().substr(11, 12); - vttContent += `${index + 1}\n${start} --> ${end}\n- ${segment.text}\n\n`; + vttContent += `${index + 1}\n${start} --> ${end}\n${segment.text}\n\n`; }); let vttBlob = new Blob([vttContent], {type: 'text/plain'}); @@ -118,4 +118,4 @@ export const downloadVTT = function (jsonData, title) { link.download = `${title}.vtt`; link.click(); } - \ No newline at end of file +