diff options
author | Javier Alfonso Bellota de Frutos <PhoneixSegovia@gmail.com> | 2012-07-31 13:46:02 +0200 |
---|---|---|
committer | Bertrand Lorentz <bertrand.lorentz@gmail.com> | 2012-08-04 17:57:46 +0200 |
commit | 2572e19d2d5310263c450f4717ee58d2d746b4ea (patch) | |
tree | bdee9605ec9301b04e3b4fb66d99e030954e9080 | |
parent | aaff0296fd5d7a810625a81366db02cc19ec1464 (diff) |
DuplicateSongDetector: Fix SQL so duplicates are from the same source
The SQL query was getting duplicate tracks with one of the tracks having
PrimarySourceID=1. Make sure the two tracks have the same
PrimarySourceID, and use the MusicLibrary.DbId instead of hardcoding the
value.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
-rw-r--r-- | src/DuplicateSongDetector/Banshee.DuplicateSongDetector/SongDuplicateView.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/DuplicateSongDetector/Banshee.DuplicateSongDetector/SongDuplicateView.cs b/src/DuplicateSongDetector/Banshee.DuplicateSongDetector/SongDuplicateView.cs index b13d1c2..6f168cd 100644 --- a/src/DuplicateSongDetector/Banshee.DuplicateSongDetector/SongDuplicateView.cs +++ b/src/DuplicateSongDetector/Banshee.DuplicateSongDetector/SongDuplicateView.cs @@ -210,8 +210,10 @@ namespace Banshee.DuplicateSongDetector FROM CoreTracks CT,CoreAlbums CA ON Ct.AlbumID = CA.AlbumID AND CT.TrackID IN ( SELECT - CT1.TrackID from CoreTracks CT1,CoreTracks CT2 where - CT1.PrimarySourceID=1 + CT1.TrackID from CoreTracks CT1,CoreTracks CT2 + WHERE + CT1.PrimarySourceID = ? + AND CT1.PrimarySourceID = CT2.PrimarySourceID AND CT1.TrackID <> CT2.TrackID AND CT1.TitleLowered = CT2.TitleLowered AND CT1.AlbumID = CT2.AlbumID @@ -219,7 +221,8 @@ namespace Banshee.DuplicateSongDetector AND CT1.Disc = CT2.Disc AND CT1.Duration = CT2.Duration ) - ORDER BY CT.Title,CT.ArtistID,CT.TrackNumber")); + ORDER BY CT.Title,CT.ArtistID,CT.TrackNumber", + ServiceManager.SourceManager.MusicLibrary.DbId)); while (reader.Read ()) { int ID = reader.Get<int> (0); String Title = reader.Get<String> (1); |