SRT 轉 VTT 自動化
基本介紹
不想用網上的轉換工具,要有網,先上傳,再下載,可能還要看廣告。有些工具也不是很方便。打算配合uTools的自動化助手插件搞一個一鍵格式轉換。
准備工作
- 命令行輸入
npm install srt-to-vtt -g
(需要先安裝nodejs
) - 在當前目錄打開
PowerShell
或cmd
輸入srt-to-vtt 文件名.srt --out=文件名.vtt
srt-to-vtt test.srt --out=test.vtt
將在當前目錄生成test.vtt
文件
自動化
- 安裝
uTools
微信下載 - 安裝插件
自動化助手
- 添加自己的腳本
const openToITerm = (folderPath) => {
var x = "\"" + folderPath['path'] + "\""
var command = `srt-to-vtt ` + x + ` --out=` + x.replace('.srt','.vtt')
// utools.copyText(command)
require('child_process').spawn('start', ['cmd', '/c', `"${command}"`], { shell: 'cmd.exe', detached: true })
}
if (ENTER.type === 'files') {
for(var x of ENTER.payload)
openToITerm(x)
}
utools.getPath(ENTER.payload[0])
\
測試
- 選中文件,右鍵(自定義菜單按鍵)執行
SRT TO VTT
- 轉換成功
- 嘗試多個文件轉換