I wasn't under the impression that this question was specifically referring to that bug. You can end up with duplicate tracks in your library even if you never run into that importing/rescanning bug, and I'm not sure of any way to automatically remove them now that the option is no longer available in the Mirage extension.
–
michaelmsJan 28 '11 at 18:00

Locate the sqlite3 database (~/.config/banshee-1/banshee.db) and run the following query:

delete from coretracks where TrackID in
(
select trackid from
(
select TrackID as trackid, count(TrackID) as c from coretracks
group by TitleLowered,ArtistID,AlbumID,Title
)
where c > 1
);

PS Use the command "sqlite3" to open the database, and not just "sqlite".

PPS I had to run the query several times, each run only deletes one additional duplicate. This happens because the inner select only gives you back the ID of one surplus track for each Title/Artist/Album combination.

This answer uses python to access the banshee database, then perform the sql action which donbicca lists with a twist. Instead of having to run the sql code many times, I have asked python to loop the sql code over the number of instances which exist in the sql code. You only need to run this code once. You need to replace your home path (replace "/home/JONDOE" with your home path).

#!/usr/bin/env python
import sqlite3
#open database to determine number of rows to loop over
db = sqlite3.connect('/home/me/.config/banshee-1/banshee.db')
cursor = db.cursor()
a = cursor.execute('SELECT TrackID from coretracks group by TitleLowered,ArtistID,AlbumID,Title')
a_trackid = a.fetchall()
db.close()
#Close database to ensure results do not impact future results. Then reopen database
db = sqlite3.connect('/home/me/.config/banshee-1/banshee.db')
cursor = db.cursor()
sql = ('DELETE from coretracks where TrackID in (SELECT TrackID from (SELECT TrackID as trackid, count(TrackID) as g from coretracks group by TitleLowered,ArtistID,AlbumID,Title) where g > 1)')
for i in a_trackid:
cursor.execute(sql)
db.commit()
db.close()