f-spot r4335 - in trunk: . src src/Core
- From: thomasvm svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4335 - in trunk: . src src/Core
- Date: Sun, 14 Sep 2008 08:53:41 +0000 (UTC)
Author: thomasvm
Date: Sun Sep 14 08:53:41 2008
New Revision: 4335
URL: http://svn.gnome.org/viewvc/f-spot?rev=4335&view=rev
Log:
Make sure md5 sum is stored on photo versions. Remove some debug.
Modified:
trunk/ChangeLog
trunk/src/Core/Photo.cs
trunk/src/PhotoStore.cs
Modified: trunk/src/Core/Photo.cs
==============================================================================
--- trunk/src/Core/Photo.cs (original)
+++ trunk/src/Core/Photo.cs Sun Sep 14 08:53:41 2008
@@ -640,19 +640,13 @@
public static string GenerateMD5 (System.Uri uri)
{
try {
- if (md5_cache.ContainsKey (uri)) {
- Log.DebugFormat("Return cache hit for {0}", uri);
+ if (md5_cache.ContainsKey (uri))
return md5_cache [uri];
- }
- Log.DebugFormat("Creating thumbnail for {0}", uri);
using (Gdk.Pixbuf pixbuf = ThumbnailGenerator.Create (uri))
{
- Log.DebugFormat("Created thumbnail, now serializing for {0}, ", uri);
byte[] serialized = PixbufSerializer.Serialize (pixbuf);
- Log.DebugFormat("Serialized, now hashing for {0}, ", uri);
byte[] md5 = MD5Generator.ComputeHash (serialized);
- Log.DebugFormat("Hashed for {0}, ", uri);
string md5_string = Convert.ToBase64String (md5);
md5_cache.Add (uri, md5_string);
Modified: trunk/src/PhotoStore.cs
==============================================================================
--- trunk/src/PhotoStore.cs (original)
+++ trunk/src/PhotoStore.cs Sun Sep 14 08:53:41 2008
@@ -600,12 +600,13 @@
PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
Database.ExecuteNonQuery (new DbCommand (
"UPDATE photo_versions SET name = :name, " +
- "uri = :uri, protected = :protected " +
+ "uri = :uri, protected = :protected, md5_sum = :md5_sum " +
"WHERE photo_id = :photo_id AND version_id = :version_id",
"name", version.Name,
"uri", version.Uri.ToString (),
"protected", version.IsProtected,
"photo_id", photo.Id,
+ "md5_sum", version.MD5Sum,
"version_id", version_id));
}
photo.Changes = null;
@@ -626,8 +627,6 @@
)
);
- bool needs_commit = false;
-
foreach (uint version_id in photo.VersionIds) {
if (version_id == Photo.OriginalVersionId)
continue;
@@ -635,13 +634,15 @@
PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
string version_md5_sum = Photo.GenerateMD5 (version.Uri);
- version.MD5Sum = version_md5_sum;
- needs_commit = true;
+ if (version.MD5Sum == version_md5_sum)
+ continue;
+
+ version.MD5Sum = version_md5_sum;
+ photo.Changes.ChangeVersion (version_id);
}
- if (needs_commit)
- Commit (photo);
+ Commit (photo);
}
// Dbus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]