I try to create a desktop file service action, under KDE, to split flac files by their cue and I would like it to open some terminal to display the process, ideally to wait for me to close it (for checking the potential errors).
So far I have a desktop file like this:
[Desktop Entry]
Type=Service
Encoding=UTF-8
ServiceTypes=KonqPopupMenu/Plugin,audio/x-flac,audio/x-flac+ogg,audio/x-oggflac
Icon=soundconverter
Actions=SplitFlacByCue;
[Desktop Action SplitFlacByCue]
Terminal=true
Name=split flac by cue
Icon=soundconverter
Exec=bash -c '$(file=$(basename "%f"); filename="${file%.*}"; shntool split -f \'$filename.cue\' -o \'flac flac --output-name=%f -\' -t \'%n - %p - %t\' \'$filename.flac\')'
I see no terminal, no error, it will fail due to the shntool part, where I fail to pass thr $filename variable. I've tried many variants, but it seems I don't get the right way.
Could anybody help me, please? Thank you.
[Edit]
Simply put: I need a desktop file with a script in the Exec parameter to split a flac by cue with the same name (except for extension, of course). It should be present when right clicking on a flac file. The challenge here is how to do it in one Exec entry instead of .sh file.
I have come to this:
Exec=xterm -e 'file=$(basename "%f"); filename="${file%.*}"; echo $filename; shntool split -f \""${filename}".cue\" -o '\''flac flac --output-name=%f -'\'' -t '\''%n - %p - %t'\'' \""${filename}".flac\"; bash\'
But when action is triggered, a generic error occurs, telling it can't parse the entry:
Error processing Exec field in
The issue lays in the shntool part, if I remove that, it opens xterm and prints the variables values.
A second try:
Exec=xterm -e 'file=$(basename "%f"); filename="${file%.*}"; echo $filename; shntool split -f \""$filename".cue\" -o "'"flac flac --output-name=%f -"'" -t "'"%n - %p - %t"'" \""$filename".flac\"; bash'
results in:
author - title shntool [split]: warning: cannot open non-existent
file: ["author - title.flac"] shntool [split]: error: cannot continue due to error(s) shown above
Still, I don't get the reason of this error.
[After a week...]
Here is the solution:
[Desktop Entry]
Type=Service
Encoding=UTF-8
ServiceTypes=KonqPopupMenu/Plugin,audio/x-flac,audio/x-flac+ogg,audio/x-oggflac
Icon=soundconverter
Actions=SplitFlacByCue;
[Desktop Action SplitFlacByCue]
Terminal=true
Name=split flac by cue
Icon=soundconverter
Exec=xterm -e 'path=$(dirname "%f"); echo $path; file=$(basename "%f"); filename="${file%.*}"; echo $filename; shntool split -D -f """$filename".cue"" -o "'"flac flac --output-name=%%f -"'" -t "'"%%n - %%p - %%t"'" """$filename".flac""; bash'