Skip to content

Commit

Permalink
Merge pull request #7 from vivek-nexus/v2.0.2
Browse files Browse the repository at this point in the history
v2.0.2
  • Loading branch information
vivek-nexus authored Mar 18, 2024
2 parents 074d8c4 + 8706f51 commit 5af975a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<br />
<br />
Expand Down
2 changes: 1 addition & 1 deletion extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.personName} (${entry.timeStamp})`);
lines.push(entry.personTranscript);
lines.push(''); // Add an empty line between entries
});
Expand Down
58 changes: 53 additions & 5 deletions extension/content.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let transcript = []
let personNameBuffer = "", transcriptTextBuffer = ""
let personNameBuffer = "", transcriptTextBuffer = "", timeStampBuffer = undefined
let beforePersonName = "", beforeTranscriptText = ""
const options = {
year: 'numeric',
Expand All @@ -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
const extensionStatusJSON_bug = {
"status": 400,
Expand All @@ -28,6 +28,7 @@ checkExtensionStatus().then(() => {
const captionsButton = contains(".material-icons-extended", "closed_caption_off")[0]

console.log("Meeting started")

setTimeout(() => {
// pick up meeting name after a delay
meetingTitle = updateMeetingTitle()
Expand Down Expand Up @@ -192,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]
Expand All @@ -204,26 +205,33 @@ 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()
transcriptTextBuffer = currentTranscriptText
}
// same person speaking more
else {
// string subtraction
transcriptTextBuffer += currentTranscriptText.substring(currentTranscriptText.indexOf(beforeTranscriptText) + beforeTranscriptText.length)
beforeTranscriptText = currentTranscriptText
}
}
}
else {
// no transcript yet or no one is speaking
console.log("No active transcript")
if ((personNameBuffer != "") && (transcriptTextBuffer != "")) {
pushToTranscript()
Expand All @@ -243,6 +251,7 @@ function transcriber(mutationsList, observer) {
function pushToTranscript() {
transcript.push({
"personName": personNameBuffer,
"timeStamp": timeStampBuffer,
"personTranscript": transcriptTextBuffer
})
}
Expand Down Expand Up @@ -289,3 +298,42 @@ async function checkExtensionStatus() {
}



// CURRENT GOOGLE MEET TRANSCRIPT DOM

{/* <div class="a4cQT" jsaction="bz0DVc:HWTqGc;TpIHXe:c0270d;v2nhid:YHhXNc;kDAVge:lUFH9b;QBUr8:lUFH9b;stc2ve:oh3Xke"
jscontroller="D1tHje" style="right: 16px; left: 16px; bottom: 80px;">
<div>
<div class="iOzk7" jsname="dsyhDe" style="">
//PERSON 1
<div class="TBMuR bj4p3b" style="">
<div><img alt="" class="KpxDtd r6DyN"
src="https://lh3.googleusercontent.com/a/some-url"
data-iml="453">
<div class="zs7s8d jxFHg">Person 1</div>
</div>
<div jsname="YSxPC" class="Mz6pEf wY1pdd" style="height: 28.4444px;">
<div jsname="tgaKEf" class="iTTPOb VbkSUe">
<span>Some transcript text.</span>
<span>Some more text.</span></div>
</div>
</div>
// PERSON 2
<div class="TBMuR bj4p3b" style="">
<div><img alt="" class="KpxDtd r6DyN"
src="https://lh3.googleusercontent.com/a/some-url"
data-iml="453">
<div class="zs7s8d jxFHg">Person 2</div>
</div>
<div jsname="YSxPC" class="Mz6pEf wY1pdd" style="height: 28.4444px;">
<div jsname="tgaKEf" class="iTTPOb VbkSUe">
<span>Some transcript text.</span>
<span>Some more text.</span></div>
</div>
</div>
</div>
<div class="iOzk7" jsname="APQunf" style="display: none;"></div>
</div>
<More divs />
</div> */}
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 5af975a

Please sign in to comment.