[banshee] [TrackInfo] Don't include Duration in MetadataHash
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [TrackInfo] Don't include Duration in MetadataHash
- Date: Tue, 2 Mar 2010 01:26:21 +0000 (UTC)
commit 1ac305574895b69f5717fa9cb9d04d8451c4c319
Author: Travis Reitter <treitter gmail com>
Date: Mon Mar 1 17:22:37 2010 -0800
[TrackInfo] Don't include Duration in MetadataHash
Fixes issue with transcoded songs that have slightly different lengths
not being considered the same, so they're always resynced (bgo#611537).
Signed-off-by: Gabriel Burt <gabriel burt gmail com>
.../Banshee.Core/Banshee.Collection/TrackInfo.cs | 1 -
.../Banshee.Database/BansheeDbFormatMigrator.cs | 40 +++++++++++++++++++-
2 files changed, 39 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
index 5d72041..5df37a5 100644
--- a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
+++ b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
@@ -382,7 +382,6 @@ namespace Banshee.Collection
System.Text.StringBuilder sb = new System.Text.StringBuilder ();
sb.Append (AlbumTitle);
sb.Append (ArtistName);
- sb.Append ((int)Duration.TotalSeconds);
sb.Append (Genre);
sb.Append (TrackTitle);
sb.Append (TrackNumber);
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index dd08c8d..38891f4 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -56,7 +56,7 @@ namespace Banshee.Database
// NOTE: Whenever there is a change in ANY of the database schema,
// this version MUST be incremented and a migration method
// MUST be supplied to match the new version number
- protected const int CURRENT_VERSION = 38;
+ protected const int CURRENT_VERSION = 39;
protected const int CURRENT_METADATA_VERSION = 7;
#region Migration Driver
@@ -852,6 +852,44 @@ namespace Banshee.Database
#endregion
+#region Version 39
+
+ [DatabaseVersion (39)]
+ private bool Migrate_39 ()
+ {
+ // One time fixup to MetadataHash, since we no longer include the Duration
+ string sql_select = @"
+ SELECT t.TrackID, al.Title, ar.Name,
+ t.Genre, t.Title, t.TrackNumber, t.Year
+ FROM CoreTracks AS t
+ JOIN CoreAlbums AS al ON al.AlbumID=t.AlbumID
+ JOIN CoreArtists AS ar ON ar.ArtistID=t.ArtistID
+ ";
+
+ HyenaSqliteCommand sql_update = new HyenaSqliteCommand (@"
+ UPDATE CoreTracks SET MetadataHash = ? WHERE TrackID = ?
+ ");
+
+ StringBuilder sb = new StringBuilder ();
+ using (var reader = new HyenaDataReader (connection.Query (sql_select))) {
+ while (reader.Read ()) {
+ sb.Length = 0;
+ sb.Append (reader.Get<string> (1));
+ sb.Append (reader.Get<string> (2));
+ sb.Append (reader.Get<string> (3));
+ sb.Append (reader.Get<string> (4));
+ sb.Append (reader.Get<int> (5));
+ sb.Append (reader.Get<int> (6));
+ string hash = Hyena.CryptoUtil.Md5Encode (sb.ToString (), System.Text.Encoding.UTF8);
+ connection.Execute (sql_update, hash, reader.Get<int> (0));
+ }
+ }
+
+ return true;
+ }
+
+#endregion
+
#pragma warning restore 0169
#region Fresh database setup
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]