Announcement

Collapse
No announcement yet.

Help with Dolphin service menu

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Help with Dolphin service menu

    I have a couple Dolphin service menus for file conversions using ffmpeg. For the life of me I cannot figure out how to not retain the original file extension.

    For example: converting "MySong.m4a" to mp3 results in "MySong.m4a.mp3". Obviously I want "MySong.mp3"​

    The functional part looks like this currently: ffmpeg -i %u -y %u.mp3

    I've tried this, but the conversion fails: ffmpeg -i %u -y $(basename %u | sed 's/\(.*\)\..*/\1/').mp3

    I've also tried using a variable like this: fn=$(basename %u | sed 's/\(.*\)\..*/\1/'); ffmpeg -i %u -y "$fn" | sed 's/\(.*\)\..*/\1/').mp3 but that just spits out an error message:

    Code:
    Syntax error in command dbusRef=$(kdialog --title="Conversion ffmpeg" --progressbar "
    Converting $(basename %f) " 0); fn=$(basename %u | sed 's/\.*\\.*/\/'); ffmpeg -i %u -y "$fn" | sed 's/\.*\\.*/\/').mp3;
    qdbus $dbusRef close; kdialog --title "Conversion complete" --passivepopup "$(basename %f) converted to MP3."; coming from
    ​

    Please Read Me

    #2
    This doesn't work either:

    ffmpeg -i %u -y $(%u | sed 's/\(.*\)\..*/\1/').mp3

    There's a delay like it's doing the conversion, but no output file

    Please Read Me

    Comment


      #3
      Eureka! This seems to work:

      fn=%u; ffmpeg -i %u -y "${fn%.*}".mp3

      Please Read Me

      Comment


        #4
        For those that worry about bashisms, removing smallest or largest, prefix or suffix, patterns are POSIX shell features, so they work in dash.
        Regards, John Little

        Comment

        Users Viewing This Topic

        Collapse

        There are 0 users viewing this topic.

        Working...
        X