Skip to content

Commit 0bc2963

Browse files
authored
Chore/improve extract percent display (#7)
* chore: improve extract percent display * doc: avoid mis-understanding * chore: add version check action * chore: bump version
1 parent eb3c93f commit 0bc2963

5 files changed

Lines changed: 23 additions & 5 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Version Check
2+
on:
3+
pull_request:
4+
branches:
5+
- 'main'
6+
7+
jobs:
8+
check-version-bump:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Check version bump
15+
uses: bachmacintosh/need-npm-package-version-bump@v1
16+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1. 进入视频所在目录
1212
2. 命令行执行:`npx dual-subtitle`
1313

14-
注:有些环境(比如群晖)如果没有npx,可以试试用`npm exec dual-subtitle`代替。
14+
注:有些环境(比如群晖)如果没有`npx`,可以用`npm exec`代替。
1515

1616
生成的字幕文件会以`.chs-eng.srt`结尾。
1717

extractSub.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import readline from 'readline';
12
import ffmpegInstaller from '@ffmpeg-installer/ffmpeg';
23
import ffmpeg from 'fluent-ffmpeg';
34
import {config} from "./config.js";
@@ -44,7 +45,8 @@ export const extractSub = (filename, targetSubs) => {
4445
})
4546
.on('progress', function (progress) {
4647
const progressPercent = Math.round((timemarkToSeconds(progress.timemark) / duration) * 100);
47-
console.log(`进行中,完成${(progressPercent || 0)}%`);
48+
readline.cursorTo(process.stdout, 0);
49+
process.stdout.write(`进行中,完成${(progressPercent || 0)}%`);
4850
})
4951
.on('end', function (str) {
5052
console.log('转换任务完成!');

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dual-subtitle",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"main": "index.js",
55
"type": "module",
66
"bin": {

0 commit comments

Comments
 (0)