#! /bin/bash
#
# M3U CDWRITER
# 10/16/2003
# rory o'connor - rory | thewhiteroom.com
#
# writes CDs from .m3u files created with XMMS
# Tracks are written in the order they appear in
# the .m3u file.
#
# prerequisites:
# lame
# normalize
# cdrecord
# m3u playlist no longer than 1:19 (for 80min cd)
#
######configuration
# "dev" parameter to cdrecord. if you don't know,
# try 'cdrecord --scanbus' on the cmd line
dev=1,2,0
#
# speed of the cdrecorder
speed=12
#
# the temp directory for .wav files
# THIS SCRIPT CREATES AND REMOVES IT
holding=$HOME/cdtmpdir # no trailing slash
file=""
m3u=""
zero=0
count=0
if [ -d $holding ]; then echo "CD temp ($holding) cannot already exist...exiting."; exit; fi
echo "Please enter the path and filename of the .m3u file you want to write to CD relative to $HOME:"
read m3u
file=$HOME/$m3u
if [ -f $file ]
then
# make the temp directory
mkdir $holding
for file in $file
do
grep -v '^#' $file | while read line
do
count=$[ $count + 1 ]
name=`echo $line | awk -F"*" '{print $1}'`
echo "$name"
# check the length of $count
length=`echo "$count" | wc -c | cut -c1-8`
length=$[ $length - 1 ]
# fix the count to a 2-digit number
if [ $length = 1 ]; then
newcount=$zero$count
else
newcount=$count
fi
# write wav file to our holding pen
lame --decode "$name" $holding/$newcount.wav
done
done
# normalize the wav files
normalize -m $holding/*.wav
# burn the CD
cdrecord dev=$dev -eject speed=$speed -pad -audio $holding/*.wav
# remove the files
for file in `ls -1 $holding`
do
rm -f $holding/$file
done
rmdir $holding
else
echo "file does not exist."
fi
Saturday, October 18, 2003
Create CDs from XMMS playlists
Subscribe to:
Post Comments (Atom)


No comments:
Post a Comment