Advertisement
Guest User

mlapaglia

a guest
Feb 11th, 2009
1,102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.56 KB | None | 0 0
  1. #!/bin/bash
  2. #########################################################
  3. # Flac to Mp3 Conversion Software                       #
  4. # Script Created by Nick Sklavenitis                    #
  5. # Script modified by ambientsound                       #
  6. # Date: September 18 2007                               #
  7. #########################################################
  8. # modify the lame options to your preference.
  9. lame_opts=" --vbr-new -V 0 "
  10.  
  11. # Creates the loop that allows more than 1 file to be specified, Can use single file name or example *.flac
  12. for x in "${@}"
  13.         do
  14.                 FLAC=${x}
  15.                 MP3=`basename "${FLAC%.flac}.mp3"`
  16.                 [ -r "$FLAC" ] || { echo "can not read file \"$FLAC\"" >&1 ; exit 1 ; } ;
  17.  
  18. #This section pulls the Tag info from flac and stores it as a variable.
  19.  
  20. TITLE="`metaflac --show-tag=TITLE "$FLAC" | awk -F = '{ printf($2) }'`"
  21. ALBUM="`metaflac --show-tag=ALBUM "$FLAC" | awk -F = '{ printf($2) }'`"
  22. ARTIST="`metaflac --show-tag=ARTIST "$FLAC" | awk -F = '{ printf($2) }'`"
  23. TRACKNUMBER="`metaflac --show-tag=TRACKNUMBER "$FLAC" | awk -F = '{ printf($2) }'`"
  24. GENRE="`metaflac --show-tag=GENRE "$FLAC" | awk -F = '{ printf($2) }'`"
  25. COMMENT="`metaflac --show-tag=COMMENT "$FLAC" | awk -F = '{ printf($2) }'`"
  26. DATE="`metaflac --show-tag=DATE "$FLAC" | awk -F = '{ printf($2) }'`"
  27.  
  28. #This section handles the conversion of the Flac file to MP3
  29.  
  30. flac -dc "$FLAC" | lame${lame_opts} \
  31. --tt "$TITLE" \
  32. --tn "$TRACKNUMBER" \
  33. --tg "$GENRE" \
  34. --ty "$DATE" \
  35. --ta "$ARTIST" \
  36. --tl "$ALBUM" \
  37. --add-id3v2 \
  38. - "$MP3"
  39.  
  40. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement