천현우

TTP: update TTP functions, insert/delete tab

'기본 함수 사용',
'인풋', -> input()
'스플릿', -> .split()
'프린트', -> print(
'섬', -> sum(
'맥스', -> max(
......
......@@ -1368,15 +1368,23 @@ function transcribeText() {
}
let input_line = ""
function uploadSoundData(blob) {
let tab = '';
let before_val = '';
let chk = 1;
let tmp = [];
async function uploadSoundData(blob) {
let filename = new Date().toISOString();
let xhr = new XMLHttpRequest();
let formData = new FormData();
xhr.onload = function(e) {
if(this.readyState === 4) {
let transcript = JSON.parse(e.target.responseText)
let transcript = JSON.parse(e.target.responseText) + '';
document.getElementById("output").innerHTML += `${cnt++}: ${transcript}<br><br>`;
uploadTranscriptData(transcript);
tmp = transcript.split(' ');
if (tmp[0] == '종료') tab = tab.slice(1);
else{
uploadTranscriptData(tab, transcript);
}
}
};
formData.append("audio_data", blob, filename);
......@@ -1384,7 +1392,7 @@ function uploadSoundData(blob) {
xhr.send(formData);
}
function uploadTranscriptData(txt) {
async function uploadTranscriptData(tabs, txt) {
let request = new XMLHttpRequest();
let form = new FormData();
request.onload = function(e) {
......@@ -1392,9 +1400,13 @@ function uploadTranscriptData(txt) {
console.log(e.target.responseText)
input_line += e.target.responseText;
sourceEditor.setValue(input_line);
if ((tmp[0] == '함수' || tmp[0] == '반복문' || tmp[0] == '조건문') && e.target.responseText != '') {
tab += '\t';
}
}
};
form.append("transcript_data", txt);
form.append("tabs", tabs);
request.open("POST", "/ttp", true);
request.send(form);
}
\ No newline at end of file
......
This diff is collapsed. Click to expand it.