#!/bin/rc
# Given raw tracks in /tmp/cdtracks and aux/cddb output on stdin,
# rips music to /lib/music/artist/album/
sed 's/ \/ /\n/' $1 | sed 's/^title //
s/ /_/g' > /tmp/cleanedup
tail +2 /tmp/cleanedup | awk '/^[1-9] /{print "0"$1"-"$2} /^[1-9][0-9] /{print $1"-"$2}'
artist = `{sed 1q /tmp/cleanedup}
album = `{sed 2q /tmp/cleanedup | tail -1}
if (! test -e /lib/music/$artist) {
mkdir /lib/music/$artist
}
if (! test -e /lib/music/$artist/$album) {
mkdir /lib/music/$artist/$album
}
tail +2 /tmp/cleanedup | awk '/^[1-9] /{print "0"$1"-"$2} /^[1-9][0-9] /{print $1"-"$2}' > /tmp/tracknames
for (j in `{ls /tmp/cdtracks}) {
songname = `{sed 1q /tmp/tracknames}
tail +2 /tmp/tracknames > /tmp/foobar
mv /tmp/foobar /tmp/tracknames
dd -conv swab < $j | /bin/games/mp3enc -r -b 128 >/lib/music/$artist/$album/$songname.mp3
}
|