Author: simplet
Date: 2008-11-29 09:59:45 +0100 (Sat, 29 Nov 2008)
New Revision: 2914
Added:
software_suite_v2/software/scripts/AlerteEmailDbusThunderbird_2.py
Log:
* Initial Import Tbird DBUS
Added: software_suite_v2/software/scripts/AlerteEmailDbusThunderbird_2.py
===================================================================
--- software_suite_v2/software/scripts/AlerteEmailDbusThunderbird_2.py
(rev 0)
+++ software_suite_v2/software/scripts/AlerteEmailDbusThunderbird_2.py
2008-11-29 08:59:45 UTC (rev 2914)
@@ -0,0 +1,90 @@
+#!/usr/bin/python
+# -*- coding: latin1 -*-
+
+"""
+Author: Simplet <simplet _at_ ptigeek _dot_ net>
+
+Script tournant en tache de fond et monitorant les messages DBUS envoyés
+par l'extension DBUS de Thunderbird lors de réception d'emails.
+
+Thunderbid DBUS extension can be downloaded here :
+http://www.mumbles-project.org/wp-content/uploads/2007/08/thunderbird_dbus.xpi
+
+
+TODO
+=====
+- Ajouter une attitune ou un WAV avant le message
+- filtres possible (pour ne pas tout annoncer) sur le
+ folder source ou autre (sujet, emetteur, ...)
+
+
+
+ ------------------------
+ /!\ BUG : help needed !
+ ------------------------
+
+ First, if I only use the Dbus code and print result on the screen, it works
flawlessly.
+
+ If I start using speak or led function, then it stop working after a few
seconds since I started the script :
+ the print work but not the TUX function (tts, led).
+
+ The problem come from the tux api but I don't know why.
+
+ If you want to see by yourself, simply comment or uncomment Tux functions in
"SayThat()".
+
+"""
+
+
+__author__ = 'Simplet <simplet _at_ ptigeek _dot_ net>'
+__appname__ = 'Thunderbird DBUS script'
+__version__ = '0.0.1'
+__date__ = '2008/11/29'
+__license__ = 'GPL'
+
+
+
+import os
+import sys
+
+sys.path.append("/home/simplet/REMI/developpement/test/tuxisaliveAPI")
+from TuxAPI import TuxAPI
+from TuxAPIConst import *
+
+from sys import path
+import dbus, gobject, dbus.glib
+
+from dbus.mainloop.glib import DBusGMainLoop
+
+
+def SayThat(text):
+ tux.led.both.blinkAsync(4,25, LFX_FADE)
+ text = text.encode("latin1")
+ print text
+ tux.tts.speak(text, "Julie", 100)
+ tux.led.both.off()
+
+
+def OnEmail(subject, author):
+ SayThat("Vous avez recu un email de la part de : [" + author.split("<")[0] +
"] et qui a pour objet : [" + subject + ".]")
+
+
+tux = TuxAPI('192.168.1.5', 270)
+tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'ThunderbirdDBUS', 'NONE')
+tux.server.waitConnected(10.0)
+tux.dongle.waitConnected(10.0)
+tux.radio.waitConnected(10.0)
+if tux.access.waitAcquire(10.0, ACCESS_PRIORITY_NORMAL):
+
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+ bus = dbus.SessionBus()
+
+ bus.add_signal_receiver(OnEmail,
+ dbus_interface="org.mozilla.thunderbird.DBus",
+ signal_name="NewMail")
+
+ loop = gobject.MainLoop()
+ loop.run()
+
+tux.access.release()
+tux.server.disconnect()
+tux.destroy()
Property changes on:
software_suite_v2/software/scripts/AlerteEmailDbusThunderbird_2.py
___________________________________________________________________
Name: svn:executable
+
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn