Skip to content

Commit e9144da

Browse files
authored
Fix/no video prompt (#13)
* fix: no video prompt * fix: incorrect Synology system explanation * chore: bump version
1 parent b7296d0 commit e9144da

7 files changed

Lines changed: 13 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ npx dual-subtitle
2121
npx dual-subtitle /path/to/videos
2222
```
2323

24-
> Without `npx` (e.g. some Synology setups):
25-
> `node /path/to/dual-subtitle/index.js [directory]`
24+
> If `npx` is not available (e.g. some Synology setups), use `npm exec` instead:
25+
> `npm exec dual-subtitle` (optionally add a directory argument).
2626
2727
### Output
2828

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ npx dual-subtitle
1919
npx dual-subtitle /path/to/videos
2020
```
2121

22-
> 若无 `npx`(如部分群晖环境),可用:`node /path/to/dual-subtitle/index.js [目录]`
22+
> 注:有些环境(比如群晖)如果没有 `npx`,可以用 `npm exec` 代替,对应命令:`npm exec dual-subtitle`(可加目录参数)。
2323
2424
### 输出文件
2525

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { t } from './i18n.js';
1212
const main = async () => {
1313
const mediaFiles = fs.readdirSync(config.workdir).filter((file) => config.exts.includes(path.extname(file)));
1414

15+
if (mediaFiles.length === 0) {
16+
console.log(t('noVideoFiles'));
17+
return;
18+
}
19+
1520
for (const file of mediaFiles) {
1621
console.log(t('processingFile', { file }));
1722
const subTitles = await analyzeMedia(file);

locales/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
noVideoFiles: 'No .mp4 or .mkv files found in the current directory.',
23
processingFile: ({ file }) => `Processing: ${file}`,
34
usingLocalFfprobe: 'Using local ffprobe',
45
usingLocalFfmpeg: 'Using local ffmpeg',

locales/zh.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
noVideoFiles: '当前目录下未找到 .mp4 或 .mkv 视频文件。',
23
processingFile: ({ file }) => `正在处理:${file}`,
34
usingLocalFfprobe: '使用本地ffprobe',
45
usingLocalFfmpeg: '使用本地ffmpeg',

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.6.0",
3+
"version": "0.6.1",
44
"main": "index.js",
55
"type": "module",
66
"bin": {

0 commit comments

Comments
 (0)