Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

costabunny

macrumors 68020
Original poster
May 15, 2008
2,466
71
Weymouth, UK
I have searched this one a lot and cannot find an answer. I have found a couple of command line tools that work under osx but none that do exactly what I want.

Basically I have a (probably) common issue. My music collection is old (some stuff is from the very early days of mp3) and I no longer have the CD's for a chunk of them. (lost or scratched over the years of moving around).

This relates to a couple of thousand of tracks with no apparent MP3 tags.

What I want is to write a script to hunt down these files and list their paths in a text file. I can then script the tagging procedure based on filenames. - that part is easy.

I am having trouble getting a definitive 'no tag' from any of the tools. (e.g. id3tool shows no tag info for file x.mp3 but id3ecmd shows a v2.3 tag with the correct details).

Can some Muso/scripting bod help me out here please (am about to tear my hair out).

All I need is to list the files that have no tag info (yes iTunes shows them but how to get the file list out with location is beyond me).

and I much want this to be done where I am happy - in bash. :)

UPDATE:

I have spent a WHILE looking at this and may have a solution;

Code:
#!/bin/bash
# Script to check for MP3 Tags
infile="AllFiles3.txt"
outfile="BadFiles.txt"
while IFS=£ read line
do
   var1="$line";
   echo "Filename = $var1";
   ls "$var1";
   ARTIST=$(id3info "$var1" | grep TPE1 | sed -e 's/.*: //g');
   echo "Artist = $ARTIST";
   if [ ${ARTIST+x} = x ] && [ -z "$ARTIST" ]; then
      echo "$var1" >> $outfile
   fi
done < $infile

AllFiles3.txt is the output of a nested find (lists only full paths of actual mp3 files)
there is a bit of debugging code in here and pretty much ZERO error checking right now so its a alpha script.

Running now and looking good - when the run is done I will be checking the files thoroughly and if all is good will tidy the script for others to use.

Pre-reqs: Macports with id3lib installed, no file may contain the '£' character (used as separator)

Need to do: change the script so it hunts down the mp3's itself and does not rely on the infile.

I'll update this as I progress.....
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.