Re: Conduit FSpot improvements
- From: "John Stowers" <john stowers gmail com>
- To: "Thomas Van Machelen" <thomas vanmachelen gmail com>
- Cc: Conduit <conduit-list gnome org>, Stephane Delcroix <stephane delcroix org>
- Subject: Re: Conduit FSpot improvements
- Date: Fri, 28 Sep 2007 11:28:02 +1200
Yay!
I just committed this to conduit trunk so its easier to work on.
I also added a new patch to the bug that exposes the FSpot version over DBus, so that conduit can play nicely with different FSpot versions. I have attached a patch against conduit to use this call. Thomas, can you commit this to conduit SVN if you think both patches are ok?
Also please add set_tags() and get_tags() to the base DataType, and attach the tags on a photo using these functions. Although conduit cannot deal with tag heirarchy, its a start
John
On 9/28/07, Thomas Van Machelen <thomas vanmachelen gmail com> wrote:
Hi all,
When you apply this [1] patch from gnome bugzilla to your f-spot
installation, and apply the attached patch to your conduit source code,
then you'll be able to two way sync your f-spot with existing conduit
dataproviders.
To do so, I extended the f-spot dbus interface; and created a new
conduit dataprovider that uses that dbus interface to put data into
f-spot and to query for information.
How it works: the conduit patch contains a fspotfactory that detects
when the patched f-spot is started or closed and creates the actual
dataprovider accordingly. Once the dataprovider is there you're able to
create conduits that sync to or from f-spot.
What needs work:
* currently there is no notification from f-spot when an image is
imported, removed or changed. So you have to manually sync in conduit
* when removing images from f-spot there is no way to tell it to also
delete it from the drive
Regards,
Thomas
[1] http://bugzilla.gnome.org/show_bug.cgi?id=480754
_______________________________________________
Conduit-list mailing list
Conduit-list gnome org
http://mail.gnome.org/mailman/listinfo/conduit-list
Index: conduit/dataproviders/FspotModule/FspotDbusModule.py
===================================================================
--- conduit/dataproviders/FspotModule/FspotDbusModule.py (revision 891)
+++ conduit/dataproviders/FspotModule/FspotDbusModule.py (working copy)
@@ -10,6 +10,8 @@
import conduit.DataProvider as DataProvider
import conduit.datatypes.File as File
+VERSION_REQUIRED = (0,4,0)
+
MODULES = {
"FSpotFactory" : { "type": "dataprovider-factory" }
}
@@ -23,6 +25,29 @@
TAGREMOTE_IFACE = "org.gnome.FSpot.TagRemoteControl"
TAGREMOTE_PATH = "/org/gnome/FSpot/TagRemoteControl"
+FSPOTREMOTE_IFACE = "org.gnome.FSpot.Core"
+FSPOTREMOTE_PATH = "/org/gnome/FSpot/Core"
+
+def _check_version():
+ bus = dbus.SessionBus()
+
+ try:
+ remote_object = bus.get_object(SERVICE_PATH, FSPOTREMOTE_PATH)
+ app = dbus.Interface(remote_object, FSPOTREMOTE_IFACE)
+ #convert to integer tuple
+ version = map(int, app.Version().split('.'))
+ if tuple(version) >= VERSION_REQUIRED:
+ return True
+ else:
+ logd("Wrong FSpot version: %s" % version)
+ return False
+ except dbus.exceptions.DBusException, err:
+ logd("DBUS ERROR: %s" % err)
+ return False
+ except Exception:
+ logd("BAD PROGRAMMER")
+ return False
+
def _get_photoremote():
bus = dbus.SessionBus()
@@ -241,17 +266,18 @@
gobject.timeout_add(2000, self._check_for_fspot)
def _check_for_fspot(self):
- if _get_photoremote():
+
self.handle_photoremote_up()
def handle_photoremote_up(self):
if self.fspot_key:
return
- self.fspot_key = self.emit_added (
- klass = FSpotDbusTwoWay,
- initargs=(),
- category=DataProvider.CATEGORY_PHOTOS)
+ if _check_version():
+ self.fspot_key = self.emit_added (
+ klass = FSpotDbusTwoWay,
+ initargs=(),
+ category=DataProvider.CATEGORY_PHOTOS)
def handle_photoremote_down(self):
if not self.fspot_key:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]