Created
March 13, 2011 01:24
-
-
Save yock/867769 to your computer and use it in GitHub Desktop.
Script to burn a seamless audio CD from a directory of mp3 and/or mp4 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function append_filename { | |
echo -en >> $TOCFILE "TRACK AUDIO\nFILE \"$WAV\" 0\n" | |
} | |
MP3DIR=$1 | |
TOCFILE="cd_$$.toc" | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
echo "CD_DA" > $TOCFILE | |
for i in `find "$MP3DIR" | sort` | |
do | |
TYPE=`file -b --mime-type $i` | |
WAV="`basename $i`.wav" | |
if [ $TYPE == "audio/mp4" ] | |
then | |
faad $i -o $WAV | |
append_filename | |
elif [ $TYPE == "audio/mp3" ] | |
then | |
mpg123 -w$WAV $i | |
append_filename | |
fi | |
done | |
echo -e "TOC file available at $TOCFILE" | |
cdrdao write $TOCFILE | |
IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment