Reply to topic

Desktop entry to convert audio/video files (Dolphin)

benjamind
Registered Member
Posts
5
Karma
0
My question: I'd like to create a desktop entry in (kde dolphins servicemenu) to convert audio/video files.

I have tried it with the following:

Code: Select all
[Desktop Entry]
Actions=Convertwav2Mp3
Icon=audio-x-flac
MimeType=audio/*
ServiceTypes=KonqPopupMenu/Plugin
Type=Service
X-KDE-Priority=TopLevel

[Desktop Action Convertwav2Mp3]
Exec=ffmpeg -i %f -codec:a libmp3lame -b:a 320k .out.mp3 && mv .out.mp3 %f
Icon=audio-x-flac
Name=Convertwav2Mp3


Works like a charm when put in /usr/share/kservices5/ServiceMenus/.

BUT: The mv command renames the output file to the original filename with its file extension (which is wav but should be mp3).

How can i change the command as to rename it from file.wav to file.mp3 within the Exec field?
airdrik
Registered Member
Posts
1845
Karma
5
OS
There are several user-contributed service menus on the kde store such as this one for converting to mp3/ogg that you can look at to see how to others have set these service menus up.
(though, depending on what the tool does with file names, you may need to use a little more shell magic to replace the extension; it looks like that mp3/ogg converter just tacks the new extension onto the end of the file name)

btw, the per-user directory for service menus is ~/.local/share/kservices5/ServiceMenus/


airdrik, proud to be a member of KDE forums since 2008-Dec.
benjamind
Registered Member
Posts
5
Karma
0
Thanks for the reply but i have already checked some scripts from the kde store and still i face the problem, that the file extension is doubled. Means after conversion the name is file.wav.mp3 what is quite annoying. Any hints how to solve this?

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], farid, Google [Bot], Majestic-12 [Bot], MSN [Bot], Sogou [Bot], Yahoo [Bot]