CARPENTIER Thomas <[EMAIL PROTECTED]> writes:

I added simplistic language and gender selection from the commandline.
Patch attached.

        Damien
--- tuxpidgin0.2.py	2007-05-26 16:28:59.000000000 +0200
+++ tuxpidgin0.2__new.py	2007-05-26 16:34:33.000000000 +0200
@@ -81,16 +81,36 @@
     text=text.encode('utf-8')
     tux_speak(text)
 
-# Tux speak the text   
+# Tux speak the text
 def tux_speak(text):
     print text
     tux.cmd.mouth_open()
-    tux.tts.select_voice(2,100)
+    tux.tts.select_voice(voice, 100)
     tux.tts.speak(text)
     tux.cmd.mouth_close()
 
 # Main
 
+# Get language and gender from commandline
+if "-us" in sys.argv:
+    lang = "us"
+else:
+    lang = "fr"
+
+if "-male" in sys.argv:
+    gender = "male"
+else:
+    gender = "female"
+
+voices = {
+    ("fr", "female"): SPK_FR_FEMALE,
+    ("fr", "male")  : SPK_FR_MALE,
+    ("us", "female"): SPK_US_FEMALE,
+    ("us", "male")  : SPK_US_MALE
+}
+
+voice = voices[(lang, gender)]
+
 bus = dbus.SessionBus()
 
 try:
@@ -100,8 +120,6 @@
     print "Pidgin is not launched"
     sys.exit(0)
 
-
-
 bus.add_signal_receiver(received_im_msg,
                         dbus_interface = "im.pidgin.purple.PurpleInterface",
                         signal_name = "ReceivedImMsg")
-------------------------------------------------------------------------
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

Reply via email to