convert-directory-to-ogg 636 B

12345678910111213141516171819202122232425262728
  1. #!/bin/zsh -f
  2. case $1 in
  3. m4a)
  4. for song in *.m4a ;
  5. do
  6. NEW=`basename -- "$song" .m4a`.ogg
  7. if [[ -e $NEW ]] ; then
  8. echo "Skipping ${NEW}, already converted."
  9. else
  10. faad -w -- "$song" | oggenc -o "${NEW}" -
  11. fi
  12. done
  13. ;;
  14. mp3)
  15. for song in *.mp3 ;
  16. do
  17. NEW=`basename -- "$song" .mp3`.ogg
  18. if [[ -e $NEW ]] ; then
  19. echo "Skipping ${NEW}, already converted."
  20. else
  21. sox ${song} ${NEW}
  22. fi
  23. done
  24. ;;
  25. *)
  26. echo Nothing to do
  27. esac