Hi!
2:
i modified it
3 : at line 96, i added 'try except" functions.
4 :
at line 81 => text need be encoded in 'utf-8'
text=text.encode('utf-8')
Fixed in attached file.
I am working about received message, i found a parser for html to text.
I will post it when it will done
Thomas
[EMAIL PROTECTED] a écrit :
"Julien Ruchaud" <[EMAIL PROTECTED]> writes:
Hi,
I post on the forum a new version, now Tuxdroid speaks with TTS voices
that say the contact on pidgin. I can't really test because I haven't
got tuxdroid, so I need somebody test and say if it run.
Hello,
Just tried it and I have a few comments:
1. There is a bunch of ^M at the end of the lines in the module's doc
string and in __author__, __app__name, etc. Please don't use these
in the Unix/Linux world. (See dos2unix.)
There is trailing whitespace. It's ugly and may lead to conflicts
or unnecessary diffs when merging/committing in svn. Your editor
probably has an option to remove these automatically.
2. I think you should use underscores in your function names:
received_im_msg() and buddy_signed_on() are much more readable than
receivedimmsg() and buddysignedon().
3. When pidgin is not running, your script dumps an exception; it
should catch it and print a nice, user-friendly error message
instead.
4. When I started pidgin and then your script, the latter printed on
stdout that "Blah is online" (which was right) but Tux didn't *say*
it. Both tuxdaemon and tuxttsdaemon where running
I'll keep your script running and see what happens when my contacts
come and go.
Damien
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
tux-droid-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-user
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Tux Droid - Pidgin InterFace
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# -----------------------------------------------------------------------------
# $Id: $
# -----------------------------------------------------------------------------
"""
CHANGES
=======
2007/05/26 - version 0.2:
- Tuxdroid speaks with TTS voices that say the contact on pidgin
2007/05/21 - version 0.1:
- Initial version
TODO LIST
========
- Make some actions when a conversation started
- Internationalization
- Improvement of conversion received message (html2text)
"""
__author__ = "Thomas CARPENTIER <[EMAIL PROTECTED]> & Julien Ruchaud"
__appname__ = "TuxPidgin"
__version__ = "0.2"
__date__ = "2007/05/26"
__license__ = "GPL"
# -----------------------------------------------
# Initalization of modules
# uses objects "tux" and "tss"
# -----------------------------------------------
import sys
sys.path.append('/opt/tuxdroid/api/python')
from tux import *
# Others
import dbus
import dbus.glib
import dbus.decorators
import gobject
import os
import re
import time
# This method is excute when a message is receive
def received_im_msg(account, name, message, conversation, flags):
buddy = purple.PurpleFindBuddy(account, name)
if buddy != 0:
alias = purple.PurpleBuddyGetAlias(buddy)
else:
alias = name
text = "%s says %s" % (alias, message)
text = re.sub("<.*?>", "", text)#html2text
tuxspeak(text)
# This method is excute when a buddy is sign on
def buddy_signed_on(buddyid):
alias = purple.PurpleBuddyGetAlias(buddyid)
text = "%s is online" % alias
text=text.encode('utf-8')
tux_speak(text)
# Tux speak the text
def tux_speak(text):
print text
tux.cmd.mouth_open()
tux.tts.select_voice(2,100)
tux.tts.speak(text)
tux.cmd.mouth_close()
# Main
bus = dbus.SessionBus()
try:
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
except dbus.DBusException:
print "Pidgin is not launched"
sys.exit(0)
bus.add_signal_receiver(received_im_msg,
dbus_interface = "im.pidgin.purple.PurpleInterface",
signal_name = "ReceivedImMsg")
bus.add_signal_receiver(buddy_signed_on,
dbus_interface = "im.pidgin.purple.PurpleInterface",
signal_name = "BuddySignedOn")
print "TuxPidgin is started"
loop = gobject.MainLoop()
loop.run()
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
tux-droid-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-user