Saturday, February 5, 2011

Duplicate iTunes So Lets Write some Code!


So once again new computer. My iTunes library is on a external hd connected as a network device. Since I don't want to actually bother mounting the network hd to my mac when I want to use iTunes I just wanted to add external music files to my local hd. An hour later, it's done, but practically every song is duplicated. I checked my network drive, and sure enough every song on it is doubled(not sure why). Regardless of reason I want to resolve this issue. Now of course I could use the 'find duplicate song' from the itunes menu, but that dones't quite solve the issue, as I still have to manually delete the duplicates. PLUS.. the songs are still duplicated on the network drive, so I'd have to do this again when I got another computer. There's a few software solutions out there that I could buy and try. But frankly I don't want to risk it messing something up. Instead why don't I make use of a perfectly good Sat night/sunday morning and script it myself. Open up terminal, g++ here we come! I'll post source code once I've finished it. I'll probably try to take a safe route. Write some recursive function, probably start at a top level directory. If there is another directory go into that. If not go through songs, if next song is duplicate of current song(account for something like a balhblah(1).mp4 ) remove it. Then terminate call. Recursion handles rest.

No comments: