我做了一个用ffmpeg转换我的东西的脚本
它确实:
1使用取消按钮创建进度条 2循环转换文件 3设置进度值
它工作正常但是当我点击取消
时它不会停止ffmpeg奇怪的是,当我使用像echo这样的另一个程序时,它应该像它应该是一个ffmpeg问题
可以帮助我如何找到诀窍?
listoffile="$HOME/ffmpeglist.lst"
numberoffile=$(wc -l <$listoffile)
ffmpegpath="/usr/bin/ffmpeg"
mystufvariabletouseonmyscript=$(kdialog --progressbar "hello this is a progress bar with 100 steps" 100) ; sleep 2 ; qdbus $mystufvariabletouseonmyscript showCancelButton true
until test "true" = `qdbus $mystufvariabletouseonmyscript wasCancelled` ; do
while read line ; do
qdbus $mystufvariabletouseonmyscript org.kde.kdialog.ProgressDialog.setLabelText $"Starting Conversion...processing file $line"
$ffmpegpath -i "$line" "${line%%.*}.$mp3"
value=$(( $(($a*100))/$numberoffile ))
qdbus $mystufvariabletouseonmyscript Set org.kde.kdialog.ProgressDialog value $value
a=$(($a+1))
done< "$listoffile"
done
答案 0 :(得分:0)
这是我的回答,请确保您已为此设置了一个文件夹
/ usr / share / sounds /但它是一个很好的例子,因为文件很短......所以...
ls -d -1 /usr/share/sounds/*.* > /tmp/listoffile.txt
a=$(kdialog --title $"FFmpeg Dolphin Service Menu" --progressbar $"Starting Conversion..." 100)
b=$(kdialog --title $"FFmpeg Dolphin Service Menu" --progressbar $"Global work..." 100)
qdbus $b showCancelButton true
qdbus $b org.kde.kdialog.ProgressDialog.autoClose true
numberoffile=$(wc -l <"/tmp/listoffile.txt")
echo $numberoffile
count=1
while read <&3 line ; do
while read linetwo ; do
qdbus $a org.kde.kdialog.ProgressDialog.setLabelText $"Processing file..... $line"
qdbus $a showCancelButton true
while [[ $(qdbus $a wasCancelled) != "false" || $(qdbus $b wasCancelled) != "false" ]] ; do
echo -e "$COL_RED ECHO KILLING AXEL AND KDIALOG $COL_RESET"
qdbus $a org.kde.kdialog.ProgressDialog.close
qdbus $b org.kde.kdialog.ProgressDialog.close
exit
done
qdbus $a Set org.kde.kdialog.ProgressDialog value "$linetwo"
done < <((pv -W -n "$line" | ffmpeg -y ciao.flac -i pipe:0 2>/tmp/logffm.lst) 2>&1 )
v=$(( $(($count*100))/$numberoffile ))
echo $(($count*100)) and
count=$(($count+1))
echo "qdbus $b Set org.kde.kdialog.ProgressDialog value $v"
qdbus $b Set org.kde.kdialog.ProgressDialog value $v
done 3<"/tmp/listoffile.txt"