Despite my existential angst that all modern music applications created since Winamp 2.8 suck, I have to play my music with something, so I’ve been using Banshee because it’s Good Enough. But I put up with crap, like, recently I noticed that there were dozens of duplicate tracks listed in banshee’s database. So if I queued up an album, I’d get songs repeated occasionally. Very annoying. There are other people out there with the same problem, but the only listed solution is an out-of-date plugin.
Luckily Banshee’s database is an open sqlite database1, so I poked around a bit (the database is in ~/.config/banshee-1/). Sure enough, I found duplicate entries in the CoreTracks table. Interestingly, though, there’s another table called Tracks that didn’t have the duplicated entries. And the tables are related!
So this is the command I used:
DELETE FROM CoreTracks WHERE CoreTracks.TrackID NOT IN (SELECT TrackID FROM Tracks);
This solved my duplicate tracks problem. As always when messing around with databases and the “DELETE” command, use extreme caution. I recommend a little gentle testing with SELECT commands first before you do anything stupid. Or, smarter still, back up your database first.
- I can’t even find a link to a description of the iTunes library format [↩]