muzuiget / niconvert

弹幕转换工具
252 stars 33 forks source link

是否考虑增加批量转换功能 #31

Closed scalpl closed 3 years ago

scalpl commented 3 years ago

如题,文件太多,是否可以增加一个批量转换功能呢

muzuiget commented 3 years ago

批量处理最好还是用命令行接口,在 cmd 下运行 main.pyw 就是使用命令形接口。

$ ./main.pyw --help
usage: main.pyw [-h] -o FILENAME [-f FILE] [-t] [-b] [-g] [+r WIDTHxHEIGHT] [+f NAME] [+s SIZE] [+l COUNT] [+a NAME] [+t SECONDS] [+d SECONDS] [+b HEIGHT] [+c LENGTH] [+h FILE] FILENAME

弹幕转字幕工具

optional arguments:
  -h, --help            show this help message and exit

输入输出:
  FILENAME              输入文件名
  -o FILENAME, --output-filename FILENAME
                        输出文件名

弹幕选项:
  -f FILE, --custom-filter FILE
                        过滤文件,关键词过滤规则文件名
  -t, --top-filter      过滤顶部弹幕
  -b, --bottom-filter   过滤底部弹幕
  -g, --guest-filter    过滤游客弹幕

字幕选项:
  +r WIDTHxHEIGHT, --play-resolution WIDTHxHEIGHT
                        播放分辨率,默认为 1920x1080
  +f NAME, --font-name NAME
                        字体名称,默认为自动选择
  +s SIZE, --font-size SIZE
                        字体大小,默认为 32 像素
  +l COUNT, --line-count COUNT
                        限制行数,默认为 4 行
  +a NAME, --layout-algorithm NAME
                        布局算法,默认为 sync 算法
  +t SECONDS, --tune-duration SECONDS
                        微调时长,默认为 0 秒
  +d SECONDS, --drop-offset SECONDS
                        丢弃偏移,默认为 2 秒
  +b HEIGHT, --bottom-margin HEIGHT
                        底部边距,默认为 0 像素
  +c LENGTH, --custom-offset LENGTH
                        自定偏移,默认为 00:00 秒
  +h FILE, --header-file FILE
                        样式模板,ass 的样式模板文件

如果你用 Windows,可以 main.pyw 同一个目录下写个 bat 批处理文件。

main.pyw -o ouput1.ass input1.xml
main.pyw -o ouput2.ass input2.xml
main.pyw -o ouput3.ass input3.xml

然后双击运行。

如果会 Python,直接用 Python API 更好也更灵活。

scalpl commented 3 years ago

ok

DYFeng commented 2 years ago

用命令行是最方便的

find your_danmu_path -name "*cmt.xml" -exec python3 /your_niconvert_path/main.pyw -o {}.ass {} \;