From 0f6c02d6b6a796f92000779d94be04f6eeb188ac Mon Sep 17 00:00:00 2001 From: Roman Tolkachyov Date: Mon, 11 Mar 2024 21:23:12 +0300 Subject: [PATCH 1/5] add time since record start marker to the output --- extension/background.js | 2 +- extension/content.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/extension/background.js b/extension/background.js index c3780d6..f0a102d 100644 --- a/extension/background.js +++ b/extension/background.js @@ -29,7 +29,7 @@ function downloadTranscript() { // Iterate through the transcript array and format each entry result.transcript.forEach(entry => { - lines.push(entry.personName); + lines.push(`[${entry.timeCode}] ${entry.personName}:`); lines.push(entry.personTranscript); lines.push(''); // Add an empty line between entries }); diff --git a/extension/content.js b/extension/content.js index 969bd4a..dd02e01 100644 --- a/extension/content.js +++ b/extension/content.js @@ -11,6 +11,7 @@ const options = { }; let meetingStartTimeStamp = new Date().toLocaleString("default", options).replace(/[/:]/g, '-') let meetingTitle = document.title +let startTime = Date.now(); const extensionStatusJSON_bug = { "status": 400, "message": "TranscripTonic seems to have an error
Please report it here." @@ -28,6 +29,8 @@ checkExtensionStatus().then(() => { const captionsButton = contains(".material-icons-extended", "closed_caption_off")[0] console.log("Meeting started") + startTime = Date.now() + setTimeout(() => { // pick up meeting name after a delay meetingTitle = updateMeetingTitle() @@ -241,9 +244,14 @@ function transcriber(mutationsList, observer) { } function pushToTranscript() { + const timeElapsed = Date.now() - startTime; // calculate time elapsed since start + let secondsElapsed = Math.floor(timeElapsed / 1000) + const minutesElapsed = Math.floor(secondsElapsed / 60) + secondsElapsed = secondsElapsed - minutesElapsed * 60 transcript.push({ "personName": personNameBuffer, - "personTranscript": transcriptTextBuffer + "personTranscript": transcriptTextBuffer, + "timeCode": `${minutesElapsed}:${secondsElapsed}` }) } @@ -288,4 +296,3 @@ async function checkExtensionStatus() { }); } - From 10f0e57391cdeb82fcdca4bfce4fd3cb953a5ca5 Mon Sep 17 00:00:00 2001 From: yakshaG Date: Wed, 13 Mar 2024 09:32:02 +0530 Subject: [PATCH 2/5] Improve timestamp logic and change to absolute timestamp --- extension/background.js | 2 +- extension/content.js | 63 +++++++++++++++++++++++++++++++++++------ extension/manifest.json | 2 +- extension/popup.html | 40 +++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 11 deletions(-) diff --git a/extension/background.js b/extension/background.js index f0a102d..5352ec6 100644 --- a/extension/background.js +++ b/extension/background.js @@ -29,7 +29,7 @@ function downloadTranscript() { // Iterate through the transcript array and format each entry result.transcript.forEach(entry => { - lines.push(`[${entry.timeCode}] ${entry.personName}:`); + lines.push(`${entry.personName} (${entry.timeStamp})`); lines.push(entry.personTranscript); lines.push(''); // Add an empty line between entries }); diff --git a/extension/content.js b/extension/content.js index dd02e01..37afed0 100644 --- a/extension/content.js +++ b/extension/content.js @@ -1,5 +1,5 @@ let transcript = [] -let personNameBuffer = "", transcriptTextBuffer = "" +let personNameBuffer = "", transcriptTextBuffer = "", timeStampBuffer = undefined let beforePersonName = "", beforeTranscriptText = "" const options = { year: 'numeric', @@ -9,7 +9,7 @@ const options = { minute: '2-digit', hour12: true }; -let meetingStartTimeStamp = new Date().toLocaleString("default", options).replace(/[/:]/g, '-') +let meetingStartTimeStamp = new Date().toLocaleString("default", options).replace(/[/:]/g, '-').toUpperCase() let meetingTitle = document.title let startTime = Date.now(); const extensionStatusJSON_bug = { @@ -195,7 +195,7 @@ function transcriber(mutationsList, observer) { // Callback function to execute when mutations are observed setTimeout(() => { mutationsList.forEach(mutation => { - if (document.querySelector('.a4cQT').firstChild.firstChild.childNodes.length > 0) { + if (document.querySelector('.a4cQT').firstChild.firstChild?.childNodes.length > 0) { const people = document.querySelector('.a4cQT').firstChild.firstChild.childNodes const person = people[people.length - 1] @@ -207,19 +207,25 @@ function transcriber(mutationsList, observer) { const currentPersonName = person.childNodes[0] ? person.childNodes[0].textContent : "" const currentTranscriptText = person.childNodes[1].lastChild ? person.childNodes[1].lastChild.textContent : "" + // starting fresh with a person if (beforeTranscriptText == "") { personNameBuffer = currentPersonName + timeStampBuffer = new Date().toLocaleString("default", options).toUpperCase() beforeTranscriptText = currentTranscriptText transcriptTextBuffer += currentTranscriptText } else { + // new person started speaking if (personNameBuffer != currentPersonName) { pushToTranscript() overWriteChromeStorage() beforeTranscriptText = currentTranscriptText - personNameBuffer = currentPersonName; - transcriptTextBuffer = currentTranscriptText; + personNameBuffer = currentPersonName + timeStampBuffer = new Date().toLocaleString("default", options).toUpperCase() + console.log(timeStampBuffer) + transcriptTextBuffer = currentTranscriptText } + // same person speaking more else { transcriptTextBuffer += currentTranscriptText.substring(currentTranscriptText.indexOf(beforeTranscriptText) + beforeTranscriptText.length) beforeTranscriptText = currentTranscriptText @@ -227,6 +233,7 @@ function transcriber(mutationsList, observer) { } } else { + // nothing or no one is speaking console.log("No active transcript") if ((personNameBuffer != "") && (transcriptTextBuffer != "")) { pushToTranscript() @@ -245,13 +252,13 @@ function transcriber(mutationsList, observer) { function pushToTranscript() { const timeElapsed = Date.now() - startTime; // calculate time elapsed since start - let secondsElapsed = Math.floor(timeElapsed / 1000) + let secondsElapsed = Math.floor(timeElapsed / 1000) const minutesElapsed = Math.floor(secondsElapsed / 60) secondsElapsed = secondsElapsed - minutesElapsed * 60 transcript.push({ "personName": personNameBuffer, - "personTranscript": transcriptTextBuffer, - "timeCode": `${minutesElapsed}:${secondsElapsed}` + "timeStamp": timeStampBuffer, + "personTranscript": transcriptTextBuffer }) } @@ -296,3 +303,43 @@ async function checkExtensionStatus() { }); } + + +// CURRENT GOOGLE MEET TRANSCRIPT DOM + +{/*
+
+
+ //PERSON 1 +
+
+
Person 1
+
+
+
+ Some transcript text. + Some more text.
+
+
+ + // PERSON 2 +
+
+
Person 2
+
+
+
+ Some transcript text. + Some more text.
+
+
+
+ +
+ +
*/} \ No newline at end of file diff --git a/extension/manifest.json b/extension/manifest.json index 7358b7b..6f971bd 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,6 +1,6 @@ { "name": "TranscripTonic", - "version": "2.0.1", + "version": "2.0.2", "manifest_version": 3, "description": "Simple Google Meet transcripts. Private and open source.", "action": { diff --git a/extension/popup.html b/extension/popup.html index 4a97880..5c84d5a 100644 --- a/extension/popup.html +++ b/extension/popup.html @@ -115,4 +115,42 @@

How to use TranscripTonic?

- \ No newline at end of file + + + +
+
+
+
+
+
You
+
+
+
Hello. Good morning.
+
+
+
+ +
+
+
+
+ +
+
+
+
\ No newline at end of file From d04fbf35fdf6811c0781b9aa794577bcbd65abc9 Mon Sep 17 00:00:00 2001 From: yakshaG Date: Wed, 13 Mar 2024 09:37:50 +0530 Subject: [PATCH 3/5] Remove unused code --- README.md | 2 +- extension/content.js | 10 ++-------- extension/popup.html | 40 +--------------------------------------- 3 files changed, 4 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 7854d5e..0e36094 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Simple Google Meet transcripts. Private and open source. ![marquee-large](/assets/marquee-large.png) -Extension status: 🟢 OPERATIONAL (v2.0.1) +Extension status: 🟢 OPERATIONAL (v2.0.2)

diff --git a/extension/content.js b/extension/content.js index 37afed0..bd3e2c0 100644 --- a/extension/content.js +++ b/extension/content.js @@ -11,7 +11,6 @@ const options = { }; let meetingStartTimeStamp = new Date().toLocaleString("default", options).replace(/[/:]/g, '-').toUpperCase() let meetingTitle = document.title -let startTime = Date.now(); const extensionStatusJSON_bug = { "status": 400, "message": "TranscripTonic seems to have an error
Please report it here." @@ -29,7 +28,6 @@ checkExtensionStatus().then(() => { const captionsButton = contains(".material-icons-extended", "closed_caption_off")[0] console.log("Meeting started") - startTime = Date.now() setTimeout(() => { // pick up meeting name after a delay @@ -222,18 +220,18 @@ function transcriber(mutationsList, observer) { beforeTranscriptText = currentTranscriptText personNameBuffer = currentPersonName timeStampBuffer = new Date().toLocaleString("default", options).toUpperCase() - console.log(timeStampBuffer) transcriptTextBuffer = currentTranscriptText } // same person speaking more else { + // string subtraction transcriptTextBuffer += currentTranscriptText.substring(currentTranscriptText.indexOf(beforeTranscriptText) + beforeTranscriptText.length) beforeTranscriptText = currentTranscriptText } } } else { - // nothing or no one is speaking + // no transcript yet or no one is speaking console.log("No active transcript") if ((personNameBuffer != "") && (transcriptTextBuffer != "")) { pushToTranscript() @@ -251,10 +249,6 @@ function transcriber(mutationsList, observer) { } function pushToTranscript() { - const timeElapsed = Date.now() - startTime; // calculate time elapsed since start - let secondsElapsed = Math.floor(timeElapsed / 1000) - const minutesElapsed = Math.floor(secondsElapsed / 60) - secondsElapsed = secondsElapsed - minutesElapsed * 60 transcript.push({ "personName": personNameBuffer, "timeStamp": timeStampBuffer, diff --git a/extension/popup.html b/extension/popup.html index 5c84d5a..4a97880 100644 --- a/extension/popup.html +++ b/extension/popup.html @@ -115,42 +115,4 @@

How to use TranscripTonic?

- - - -
-
-
-
-
-
You
-
-
-
Hello. Good morning.
-
-
-
- -
-
-
-
- -
-
-
-
\ No newline at end of file + \ No newline at end of file From d4f36af3428af4527f807dac15ef9ade597e8996 Mon Sep 17 00:00:00 2001 From: yakshaG Date: Wed, 13 Mar 2024 09:51:22 +0530 Subject: [PATCH 4/5] Prevent errors --- extension/content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/content.js b/extension/content.js index bd3e2c0..8571ee9 100644 --- a/extension/content.js +++ b/extension/content.js @@ -193,7 +193,7 @@ function transcriber(mutationsList, observer) { // Callback function to execute when mutations are observed setTimeout(() => { mutationsList.forEach(mutation => { - if (document.querySelector('.a4cQT').firstChild.firstChild?.childNodes.length > 0) { + if (document.querySelector('.a4cQT').firstChild?.firstChild?.childNodes.length > 0) { const people = document.querySelector('.a4cQT').firstChild.firstChild.childNodes const person = people[people.length - 1] From 8706f51017dbd259ae923984d0e02fc72a89d264 Mon Sep 17 00:00:00 2001 From: yakshaG Date: Thu, 14 Mar 2024 09:46:32 +0530 Subject: [PATCH 5/5] Prevent errors --- extension/content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/content.js b/extension/content.js index 8571ee9..b587d4f 100644 --- a/extension/content.js +++ b/extension/content.js @@ -193,7 +193,7 @@ function transcriber(mutationsList, observer) { // Callback function to execute when mutations are observed setTimeout(() => { mutationsList.forEach(mutation => { - if (document.querySelector('.a4cQT').firstChild?.firstChild?.childNodes.length > 0) { + if (document.querySelector('.a4cQT')?.firstChild?.firstChild?.childNodes.length > 0) { const people = document.querySelector('.a4cQT').firstChild.firstChild.childNodes const person = people[people.length - 1]