Advertisement
Guest User

ape2flac

a guest
Mar 13th, 2010
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1.  function apetoflac(){
  2.  if which ffmpeg &>/dev/null; then
  3.      COUNTER=$(find . -maxdepth $1 -iname "*.ape" | sed -n '$=')
  4.      until [ $COUNTER -lt 0 ]; do
  5.          export IFS=""
  6.          APEFILE=$(find . -maxdepth $1 -iname "*.ape" | head -n 1 | sed "s/^[./]*//")
  7.          if [ "$APEFILE" ]; then
  8.              FLACFILE=$(echo "$APEFILE" | sed -e "s/.ape/.flac/" )
  9.              echo "-------------------strating conversion----------------------------"
  10.              echo $APEFILE
  11.              echo $FLACFILE
  12.              ffmpeg -i $APEFILE $FLACFILE &>/dev/null
  13.              echo "Converting complete"
  14.              rm -f $APEFILE
  15.              export IFS=" "
  16.              let COUNTER-=1
  17.              echo "Only " "$COUNTER" " files left"
  18.              notify-send "Files to be done: "  "$COUNTER"
  19.       else
  20.          echo "no .ape found"
  21.          let COUNTER-=1
  22.          export IFS=" "
  23.       fi
  24.     done
  25.   else
  26.     echo "ffmeg is not on your system. aborting."
  27.     notify-send "ffmeg is not on your system. aborting."
  28.  fi                                                                                              
  29.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement