[linux-audio-dev] mp3 mess help

Jens M Andreasen jens.andreasen at chello.se
Wed Oct 27 07:34:06 UTC 2004

On ons, 2004-10-27 at 08:04, Aaron wrote:
> HI all,
> I have set of mp3's that I have been working with over the last few
> years. They have been backed up, renamed moved to different directories.
> most of them are not tagged.
> after a few crashes/loss of a hard disk etc. I am now trying to restore
> my work.
> I have a full partition with them in it but it is obvious most of them
> are there multiple times with different non discriptive names..ouch:(
> Is there a way I can searh the mp3 to find which are the same/different
> using the actual mp3 binary data??

Short version:

   1) Sort them (by binary content.)

   2) Delete duplicates.

   3) ...

   4) Profit! :)

I would probably only keep the path to the mp3 in the sorted structure,
and then open (and close) them for comparison as needed. 

'man qsort' is your friend. 

Step one:

The compare() function, that you supply to qsort, should open two files
and compare for equality until EOF (in which case they are equal) or
return when and unequalty is found.

The array you are sorting holds the paths to all of your candidate mp3s,
which you have found by recursively traversing your partition(s)

Step two:

All the paths to the mp3s are sorted so that paths with equal content
are next to each other. Go thru them once, using the same comparison
function as before. For each equal pair delete the lowest ordered file.
For each unequal pair move the lowest ordered file to a place where you
would like to keep your mp3 collection.


> any way I can avoid listening to hundreds of files would be most
> appreciated.
> any suggestions?
> Thanks
> Aaron

More information about the Linux-audio-dev mailing list