I use Dolphin service menus to extract subtitles from video files. Then, if the subtitle is ssa format, I use a second service menu to convert it to srt. Independently, they both work fine. I'd like to combine this into a single service menu; i.e extract and convert automatically when the file type is ssa.
The subtitle extraction is done with a python script that I call from the service menu like this:
The conversion to srt is much simpler and uses ffmpeg, so it's a one-liner:
I suspect I could add the conversion function to the python script, but I don't know python at all - the python script is something I found on the 'net.
I have attempted this in the service menu:
The results are the extraction occurs but not the conversion.
All the pieces in the if statement work from the command line so I think the issue is in the Service Menu action itself - like once the python script is called the service menu stops provessing.
Looking for ideas..
The subtitle extraction is done with a python script that I call from the service menu like this:
Code:
Exec=$HOME/.local/share/applications/mkvextract-allsubs-eng %u
Code:
ffmpeg -i "$fn" "${fn%.*}".srt
I have attempted this in the service menu:
Code:
Exec=$HOME/.local/share/applications/mkvextract-allsubs-eng %u; fn=%u; if [[ "${fn#"${fn%???}"}" = "ssa" ]]; then ffmpeg -i "$fn" "${fn%.*}".srt; rm "$fn"; fi
All the pieces in the if statement work from the command line so I think the issue is in the Service Menu action itself - like once the python script is called the service menu stops provessing.
Looking for ideas..







Comment