« Customer Service: Two Case Studies | Main | Bachelorhood, and New Toys »

October 19, 2007

Artist Formerly Known As, The

Well, I decided that I can't really deal with having all the artists that begin with "The" sorted under "T", so a few minutes with find, sed, and metaflac got me this:

$ IFS='
'; for file in `find . -type f -name \*.flac -print`; do 
   ARTIST=`metaflac --show-tag=ARTIST $file | sed s/ARTIST=//g`; 
   ARTISTN=`echo $ARTIST | sed '/^The/s/^The \(.*\)/\1, The/'`; 
   if [ "$ARTIST" \!= "$ARTISTN" ]; then 
      echo fixing $file \($ARTIST -\> $ARTISTN\) ; 
      metaflac --remove-tag=ARTIST --set-tag="ARTIST=$ARTISTN" $file; 
   fi; 
done

It's chugging through my flac collection now, which is housed on my spiffy new ReadyNAS (which I'll post about shortly.)

Producing lines like this:

fixing ./00 - holiday/christmas/alarm, the/the big 80s christmas/14 - happy christmas (war is over).flac (The Alarm -> Alarm, The)
fixing ./00 - holiday/christmas/beach boys, the/the ultimate christmas album, volume 4/02 - the man with all the toys.flac (The Beach Boys -> Beach Boys, The)

So far, so good.

Posted by dberger at October 19, 2007 6:26 PM