简体   繁体   English

zenity 文件处理到 python

[英]zenity file handling to python

I wanted to speed up my subtitle creation from videos by using Zenity.我想通过使用 Zenity 加快我从视频创建字幕的速度。 I have zero experience with Python and some with Zenity.我对 Python 和一些 Zenity 的体验为零。 So I did:所以我做了:

#!/bin/bash
cd ~/Desktop
file="$(zenity --title "Video to subtitles:         Select a File to convert" --file- selection )"
wavfile="$(zenity --file-selection --save --confirm-overwrite --filename="${file%.*}.wav")"
srtfile="$(zenity --file-selection --save --confirm-overwrite --filename="${file%.*}.srt")"
ffmpeg -i "$file" -c:a pcm_s16le -ac 1 "$wavfile"
cd ~/vosk-api/python/example
time python3 ./test_srt.py "$wavfile" > "$srtfile"
zenity --info --text "Conversion Completed"

Of course, I forgot the last bit uses python to do the conversion, and Python does not get along with bash, so I get zero output.当然,我忘记了最后一位使用python进行转换,而Python与bash不合,所以我得到零output。

Any takers?有接盘者吗? Yours hopefully, Fitch希望是你的,惠誉

False alarm.虚惊。 It works fine.它工作正常。 I forgot to unzip the vosk model. So the bottom part now reads:我忘了解压 vosk model。所以底部现在是:

  unzip vosk-model-small-en-us-0.3.zip
  mv vosk-model-small-en-us-0.3 model
  time python3 ./test_srt.py "$wavfile" > "$srtfile"
  zenity --info --text "Conversion Completed"

Sorry about that.对于那个很抱歉。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM