diff --git a/extract_from_ass_subtitle/2. extract_head.js b/extract_from_ass_subtitle/2. extract_head.js index 6b747ab..b220232 100644 --- a/extract_from_ass_subtitle/2. extract_head.js +++ b/extract_from_ass_subtitle/2. extract_head.js @@ -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. 备注: diff --git a/extract_from_ass_subtitle/3. extract_ass_to_txt.js b/extract_from_ass_subtitle/3. extract_ass_to_txt.js index 3e23f27..4396e3f 100644 --- a/extract_from_ass_subtitle/3. extract_ass_to_txt.js +++ b/extract_from_ass_subtitle/3. extract_ass_to_txt.js @@ -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'; } } }