[banshee] [Services] Add method for bulk-updating MetadataHash
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Services] Add method for bulk-updating MetadataHash
- Date: Fri, 14 May 2010 22:42:47 +0000 (UTC)
commit bc3e609d97bdfb38bd31fbd39d630c40f8b313e3
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu May 13 16:38:11 2010 -0700
[Services] Add method for bulk-updating MetadataHash
Given the album title and artist name and a SQL condition, will
bulk-update the CoreTracks.MetadataHash field.
.../Banshee.Core/Banshee.Collection/TrackInfo.cs | 1 +
.../DatabaseTrackInfo.cs | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
index c9e9402..2100ab5 100644
--- a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
+++ b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
@@ -386,6 +386,7 @@ namespace Banshee.Collection
public virtual string MetadataHash {
get {
System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+ // Keep this field set/order in sync with UpdateMetadataHash in DatabaseTrackInfo.cs
sb.Append (AlbumTitle);
sb.Append (ArtistName);
sb.Append (Genre);
diff --git a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
index f07b07f..c4fc5ea 100644
--- a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
@@ -726,6 +726,16 @@ namespace Banshee.Collection.Database
{
return GetTrackIdForUri (uri, primary_sources) > 0;
}
+
+ public static void UpdateMetadataHash (string albumTitle, string artistName, string condition)
+ {
+ // Keep this field set/order in sync with MetadataHash in TrackInfo.cs
+ ServiceManager.DbConnection.Execute (String.Format (
+ @"UPDATE CoreTracks SET MetadataHash = HYENA_MD5 (6, ?, ?, Genre, Title, TrackNumber, Year)
+ WHERE {0}",
+ condition), albumTitle, artistName
+ );
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]