Clean your mp3 library with the power of CPAN

Last time, I reported my problems with cleaning my iTunes library.

In the past, I had various problems with storing my mp3s, hard disk failures and consequent attempts to save them etc. I must have played back my backups more than once, anyways, I  nearly have every file at least twice.

I had a look at the SDK and it works okay with perl. Took me a while to remember how to write objects. Lately, i have been using them only, but this is another matter. Anyways, as usual: In the end I figured out an easier way and I don't have any use for all those objects. Anyways, as far as I can see there the iTunes com doesn't allow to access the files directly. Also, I coudn't figure out a perlish way how deal with the search results.

The solution is: Just delete checksum duplicates from your harddisk. No iTunes involved. As you know, there are many kinds of duplicates. For a first step, I found it save to delete those mp3 files which have the same checksum. The CPAN module Audio::Digest::MP3 even allows me to determine the checksum of the stream (neglecting metadata). Just what I am looking for at the moment.

So, in the end I wrote a little perl script that deletes those duplicates. It checks duplicates only in the same folder assuming that you never need the same track in the same bitrate etc twice in one album. Maybe you actually want to keep duplicates in different folders/album, e.g. the same track is on several albums, "Best of" etc. So, I don't delete those, only in the same folder which iTunes created nicely.

It's still running, but only testing already freed about a GB! Not, too bad...

So, one problem solved, I wonder which problem will emerge next... I am fairly confident that CPAN will meet the challenge.

BTW: When playing around with the iTunes SDK, I thought that it is quite slow. Well, maybe it is, but looking thru the mp3 files on the hard disk with File::Find takes about the same time (slightly more than 6 minutes...) If only on my weird system, i cannot say. Anyways, not so bad then.

 

 

 

AttachmentSize
rmMp3Duplicates.pl.txt4.83 KB
iTunes.rmDeadTracks.pl.txt1.49 KB
No votes yet
Theme provided by Danetsoft under GPL license from Danang Probo Sayekti