mirror of
https://github.com/1c7/Crash-Course-Computer-Science-Chinese.git
synced 2024-12-21 20:30:12 +08:00
ffff
This commit is contained in:
parent
cac08500b0
commit
9006636c5f
@ -4,11 +4,13 @@ const common = require('./common.js');
|
||||
const path = require('path')
|
||||
|
||||
/*
|
||||
2018-6-8 周五 03:42
|
||||
|
||||
1. 是什么:
|
||||
从 .ass 字幕文件中提取片头文字(共2行字幕)
|
||||
从 40 个 .ass 字幕文件中提取片头文字(共2行字幕,字幕样式名统一)
|
||||
仅针对 [计算机科学速成课] Crash Course Computer Science
|
||||
|
||||
2. 如何使用:
|
||||
2. 使用方法:
|
||||
node 2.\ extract_head.js
|
||||
|
||||
3. 备注:
|
||||
|
@ -1,11 +1,13 @@
|
||||
// ass to txt
|
||||
// 不写注释了,参考 2. extract_head.js 即可
|
||||
|
||||
const assParser = require('ass-parser');
|
||||
const fs = require('fs');
|
||||
const common = require('./common.js');
|
||||
const path = require('path')
|
||||
|
||||
var result = ''
|
||||
|
||||
var folder = '/Users/remote_edit/Desktop/ass/'
|
||||
var folder = '/Users/remote_edit/Desktop/ass/' // 40 集字幕文件的文件夹
|
||||
|
||||
function loop_current_folder_ass_file_in_order(){
|
||||
fs.readdir(folder, (err, files) => {
|
||||
@ -15,7 +17,6 @@ function loop_current_folder_ass_file_in_order(){
|
||||
var ext = path.extname(file); // ext == ass
|
||||
if (parseInt(number) === i && ext === '.ass'){
|
||||
extract_main_point(folder+file, number);
|
||||
// console.log(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -36,16 +37,10 @@ function extract_main_point(file, number){
|
||||
text = common.remove_curly_brace_keep_text(text);
|
||||
result = result + text.trim() + '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i <= body.length-1; i++) {
|
||||
var element = body[i];
|
||||
if (element.key == 'Dialogue') {
|
||||
if (element.value.Style == 'zh - 黄色'){
|
||||
var text = element.value.Text;
|
||||
text = common.remove_curly_brace_keep_text(text);
|
||||
result = result + text.trim() + '\n';
|
||||
result = result + text.trim() + '\n\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user