f-spot r4615 - in trunk/extensions/Tools: . HashJob
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4615 - in trunk/extensions/Tools: . HashJob
- Date: Mon, 24 Nov 2008 13:04:16 +0000 (UTC)
Author: sdelcroix
Date: Mon Nov 24 13:04:16 2008
New Revision: 4615
URL: http://svn.gnome.org/viewvc/f-spot?rev=4615&view=rev
Log:
2008-11-24 Lorenzo Milesi <maxxer yetopen it>
* HashJob/HashJob.cs: check for missing hashes in photo versions, and
check for empty strings also, not only for null (to work on db 16.3).
display some feedback when pressing buttons.
* HashJob/HashJob.addin.xml: bump ver. fix bgo#558671.
Modified:
trunk/extensions/Tools/ChangeLog
trunk/extensions/Tools/HashJob/HashJob.addin.xml
trunk/extensions/Tools/HashJob/HashJob.cs
Modified: trunk/extensions/Tools/HashJob/HashJob.addin.xml
==============================================================================
--- trunk/extensions/Tools/HashJob/HashJob.addin.xml (original)
+++ trunk/extensions/Tools/HashJob/HashJob.addin.xml Mon Nov 24 13:04:16 2008
@@ -1,6 +1,6 @@
<Addin namespace="FSpot"
id="HashJob"
- version="0.5.0.0"
+ version="0.5.0.1"
description="Process your photo collection for duplicate detection"
author="Stephane Delcroix"
url="http://f-spot.org/Extensions"
Modified: trunk/extensions/Tools/HashJob/HashJob.cs
==============================================================================
--- trunk/extensions/Tools/HashJob/HashJob.cs (original)
+++ trunk/extensions/Tools/HashJob/HashJob.cs Mon Nov 24 13:04:16 2008
@@ -15,7 +15,6 @@
using Gtk;
using FSpot;
-using FSpot.UI.Dialog;
using FSpot.Extensions;
using FSpot.Jobs;
@@ -31,14 +30,37 @@
public class HashJobDialog : Dialog
{
+ private Gtk.Label status_label;
public void ShowDialog ()
{
+ // This query is not very fast, but it's a 'one-time' so don't care much...
+ SqliteDataReader reader = FSpot.Core.Database.Database.Query (
+ "SELECT COUNT(*) FROM photos p WHERE md5_sum IS NULL OR md5_sum = '' OR EXISTS " +
+ "(SELECT * FROM photo_versions pv WHERE p.id=pv.photo_id AND version_id <> '1' AND " +
+ "(pv.md5_sum IS NULL OR pv.md5_sum = ''))");
+ reader.Read ();
+ uint missing_md5 = Convert.ToUInt32 (reader[0]);
+ reader.Close ();
+
+ reader = FSpot.Core.Database.Database.Query (String.Format (
+ "SELECT COUNT(*) FROM jobs WHERE job_type = '{0}' ", typeof(FSpot.Jobs.CalculateHashJob).ToString ()));
+ reader.Read ();
+ uint active_jobs = Convert.ToUInt32 (reader[0]);
+ reader.Close ();
+
VBox.Spacing = 6;
- Label l = new Label ("In order to detect duplicates on pictures you imported before f-spot 0.5.0, f-spot need to analyze your image collection. This is is not done by default as it's time consuming. You can Start or Pause this update process using this dialog.");
+ Label l = new Label (Catalog.GetString ("In order to detect duplicates on pictures you imported before 0.5.0, " +
+ "F-Spot needs to analyze your image collection. This is is not done by default as it's time consuming. " +
+ "You can Start or Pause this update process using this dialog."));
l.LineWrap = true;
VBox.PackStart (l);
+ Label l2 = new Label (Catalog.GetString (String.Format ("You currently have {0} photos needing md5 calculation, and {1} pending jobs",
+ missing_md5, active_jobs)));
+ l2.LineWrap = true;
+ VBox.PackStart (l2);
+
Button execute = new Button (Stock.Execute);
execute.Clicked += HandleExecuteClicked;
VBox.PackStart (execute);
@@ -47,11 +69,13 @@
stop.Clicked += HandleStopClicked;
VBox.PackStart (stop);
+ status_label = new Label ();
+ VBox.PackStart (status_label);
+
this.AddButton ("_Close", ResponseType.Close);
this.Response += HandleResponse;
ShowAll ();
-
}
void HandleResponse (object obj, ResponseArgs args)
@@ -66,18 +90,24 @@
void HandleExecuteClicked (object o, EventArgs e)
{
- SqliteDataReader reader = FSpot.Core.Database.Database.Query ("SELECT id from photos WHERE md5_sum IS NULL");
+ SqliteDataReader reader = FSpot.Core.Database.Database.Query (
+ "SELECT id FROM photos p WHERE md5_sum IS NULL OR md5_sum = '' OR EXISTS " +
+ "(SELECT * FROM photo_versions pv WHERE p.id=pv.photo_id AND version_id <> '1' AND " +
+ "(pv.md5_sum IS NULL OR pv.md5_sum = '') )");
FSpot.Core.Database.Database.BeginTransaction ();
while (reader.Read ())
FSpot.Jobs.CalculateHashJob.Create (FSpot.Core.Database.Jobs, Convert.ToUInt32 (reader[0]));
reader.Close ();
FSpot.Core.Database.Database.CommitTransaction ();
+ status_label.Text = Catalog.GetString ("Processing images...");
}
void HandleStopClicked (object o, EventArgs e)
{
FSpot.Core.Database.Database.ExecuteNonQuery (String.Format ("DELETE FROM jobs WHERE job_type = '{0}'", typeof(FSpot.Jobs.CalculateHashJob).ToString ()));
+ status_label.Text = Catalog.GetString ("Stopped");
}
+
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]