Hi,
In article <[EMAIL PROTECTED]>,
Andy Hawkins<[EMAIL PROTECTED]> wrote:
> Great, sounds good. I might do something myself just to prove I still can :)
Ok, I've knocked up a shell script to do the ripping, and a PERL script to
convert a toc file to a list of tags.
The script is simple:
#!/bin/sh
rm -f album.*
cdrdao read-cd --device ATAPI:0,0,0 --driver generic-mmc --with-cddb \
--datafile album.bin album.toc
cueconvert -f album.toc -f album.cue
flac --endian=big --sign=signed --channels=2 --bps=16 --sample-rate=44100 \
--cuesheet=album.cue album.bin
cat album.toc | ./toc2tag.pl > album.tags
metaflac --add-replay-gain --no-utf8-convert --import-tags-from=album.tags \
album.flac
ALBUM=`grep ALBUM album.tags | cut -d '=' -f 2`
ARTIST=`grep ARTIST album.tags | cut -d '=' -f 2`
mkdir -p "$ARTIST/$ALBUM"
mv album.flac "$ARTIST/$ALBUM/$ALBUM.flac"
rm -f album.*
The perl script parses the toc file and creates a list of tags suitable for
passing to metaflac:
#!/usr/bin/perl -w
$GotAlbum=0;
$Tracknum=0;
$IsVarious=0;
$Artist="";
while (<>)
{
if (/\/\/ Track (\d*)/)
{
$Tracknum=$1;
print "TRACKNUMBER[$Tracknum]=$Tracknum\n";
}
if (/TITLE "(.*)"/)
{
if (!$GotAlbum)
{
$GotAlbum=1;
$Album=$1;
$Album=~ s/\// - /;
print "ALBUM=$Album\n";
}
else
{
print "TITLE[$Tracknum]=$1\n";
}
}
if (/PERFORMER "(.*)"/)
{
if ($Tracknum==0)
{
$Artist=$1;
$Artist=~ s/\// - /;
print "ARTIST=$Artist\n";
}
else
{
if ($1 ne $Artist)
{
print "ARTIST[$Tracknum]=$1\n";
}
}
}
}
I've only run this on one album so far, and it appears to work :)
It *might* have a problem with 'Various artists' type albums, but I'll try
this as and when I need to rip one!
Hope this might be useful to someone.
Andy
_______________________________________________
Discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss