I want code to right click context menu on a file and if it is a .mp4, then convert that to a .mp3 of the same name

also include an option to play faster by +25 +33 +50 or slower by -25 -33 -50 (in a sub menu)

I understand this is different depending on your system, so answer how to do it for the people who use the same system as you

  • Captain Aggravated@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    8 hours ago

    In the Cinnamon desktop, there’s a directory in ~/.local/share/nemo/actions. Navigate to this directory in Nemo file manager and a message will appear across the top, it has a built-in tutorial as to how to do this. You create a short config file with a .nemo_action that defines what an action does, what context it appears in, what text it displays, what icon it displays etc. and the command to run when chosen.

    It’s been about a year since I’ve messed with this, but IIRC if it’s set up to fire with one or more files selected, it will pass the file names to the command as arguments. You can configure it to run on exactly one, one or many, or specifically plural files. A thing I did a lot was allow it to take multiple files and then iterate across the variables in a for loop, so say I used pandoc to convert .docx files to .pdf, I could highlight 50 of them, click one option and it would churn through all of them.

    I’m not going to build the script for you, but the first approach that occurs to me would be to write a shell script that calls ffmpeg to do the conversion, get that to where it works when you invoke it from the terminal, then write a .nemo_action file to fire it from the GUI.

    As for the playback speeds…I’m not sure how to get that done. If you mean “take this .mp4 and make an .mp3 out of its audio that is 25% faster” I think what would happen there is you’d write a little GUI pop-up window, I would do it in Python with either a GTK or QT module, that would open up to ask parameters before passing that back to the main script to do the work.