简体   繁体   中英

zenity file handling to python

I wanted to speed up my subtitle creation from videos by using Zenity. I have zero experience with Python and some with 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.

Any takers? Yours hopefully, Fitch

False alarm. It works fine. I forgot to unzip the vosk model. So the bottom part now reads:

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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