Skip to content

Commit

Permalink
Update Big update very muchhhhhhh!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
watchakorn-18k committed Sep 30, 2023
1 parent c5c06ad commit 968d556
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
22 changes: 16 additions & 6 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,23 @@ let vttToSrt = (vttText) => {
let numberline = 1;
let result = []

for (let i = 0; i < lines.length; i++) {
lines[i] = lines[i].replace('\r', '\n').replace('.', ',').replace('.', ',');
console.log(lines[i]);
if (lines[i].startsWith('00')) {
result.push(lines.slice(i, i + 2).join('') + '\n\n');
if (lines.includes('Language: en')) {
for (let i = 0; i < lines.length; i++) {
lines[i] = lines[i].replace('\r', '\n').replace('.', ',').replace('.', ',');
if (lines[i].startsWith('00')) {
result.push(lines.slice(i, i + 2).join('\n') + '\n\n');
}
}

} else {
for (let i = 0; i < lines.length; i++) {
lines[i] = lines[i].replace('\r', '\n').replace('.', ',').replace('.', ',');
if (lines[i].startsWith('00')) {
result.push(lines.slice(i, i + 2).join('') + '\n\n');
}
}
}
console.log(lines);

// while (i < result.length) {
// if (result[i].indexOf("-->") !== -1) {
Expand All @@ -61,7 +71,7 @@ let vttToSrt = (vttText) => {
// i++;
// }
let resultString = result.join("");
console.log(resultString);
// console.log(resultString);
return resultString;
}
let text_dwl = "ดาวน์โหลด";
Expand Down
31 changes: 19 additions & 12 deletions t.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
test = ['WEBVTT\r', '\r', '00:00:31.460 --> 00:00:33.100\r', '♪ ดนตรีแห่งการผจญภัย ♪\r','00:01:43.860 --> 00:01:50.140\r', '♪การเริ่มต้นใหม่อยู่ที่นี่♪\r', '\r', '00:01:51.700 --> 00:02:02.020\r', '[เชฟมหัศจรรย์แห่งน้ำแข็งและไฟ S2]\r',]

let result = [];

for (let i = 0; i < test.length; i++) {
test[i] = test[i].replace('\r', '\n').replace('.', ',').replace('.', ',');
console.log(test[i]);
if (test[i].startsWith('00')) {
result.push(test.slice(i, i + 2).join('') + '\n\n');
}
}

let resultString = result.join("");
// console.log(resultString);
// let result = [];

// for (let i = 0; i < test.length; i++) {
// test[i] = test[i].replace('\r', '\n').replace('.', ',').replace('.', ',');
// console.log(test[i]);
// if (test[i].startsWith('00')) {
// result.push(test.slice(i, i + 2).join('') + '\n\n');
// }
// }

// let resultString = result.join("");
// console.log(resultString);


const array = ['a', 'b'];

if (array.includes('a')) {
console.log('wow');
}
8 changes: 4 additions & 4 deletions t.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


for i,k in enumerate(test):
test[i] = test[i].replace('\r', '\n').replace('.',',')
if k.startswith('00'):
result.append(''.join(str(e) for e in test[i:i+2])+"\n")

for i,k in enumerate(test):
test[i] = test[i].replace('\r', '\n').replace('.',',')
if k.startswith('00'):
result.append('\n'.join(str(e) for e in test[i:i+2])+"\n")
print(result)

0 comments on commit 968d556

Please sign in to comment.