Sync with github

parent 65853bc0
domotikad
=========
Domotika home automation system controller daemon
Domotikad developement has moved to https://git.nexlab.net/nexlab/domotikad
Donations are accepted in Bitcoins to 1GpZkuwMEXno7jW19oqoaraVoVS6VBCvX5
To change git origin:
* git remote rm origin
* git remote add origin https://git.nexlab.net/nexlab/domotikad.git
[Screenshots of the webgui](http://www.unixmedia.it/en/interfaccia-utente)
[![piwik tracking](https://webstats.unixmedia.it/piwik.php?idsite=2&rec=1&action_name=GitHubDomotikad "unixmedia.it")](http://www.unixmedia.it)
......@@ -194,7 +194,8 @@
audio.setAttribute('id' , 'playTTS_audio');
}
// XXX BUG: webkit based browsers seems to not work with https:// in <audio>, so, we fix this to http
audio.setAttribute('src', 'http://translate.google.com/translate_tts?tl='+lang+'&q=' + encodeURIComponent(text));
//audio.setAttribute('src', 'http://translate.google.com/translate_tts?tl='+lang+'&q=' + encodeURIComponent(text));
audio.setAttribute('src', 'http://code.responsivevoice.org/getvoice.php?tl='+lang+'&t=' + encodeURIComponent(text));
audio.load();
audio.play();
return audio;
......
a:2:{s:9:"timestamp";i:1395332244;s:12:"translations";a:18:{s:4:"home";s:4:"home";s:5:"blind";s:10:"tapparelle";s:8:"cancello";s:8:"cancelli";s:5:"clima";s:5:"clima";s:4:"door";s:5:"porte";s:3:"led";s:3:"led";s:5:"light";s:4:"luci";s:7:"scenari";s:7:"scenari";s:6:"socket";s:5:"prese";s:6:"valvle";s:7:"valvole";s:6:"sensor";s:7:"sensori";s:6:"camera";s:10:"telecamere";s:6:"window";s:8:"finestre";s:4:"user";s:4:"user";s:4:"none";s:15:"Nessuna Sezione";s:5:"phone";s:8:"telefono";s:5:"index";s:4:"Home";s:4:"gate";s:8:"cancelli";}}
\ No newline at end of file
a:2:{s:9:"timestamp";i:1441816319;s:12:"translations";a:18:{s:4:"home";s:4:"home";s:5:"blind";s:10:"tapparelle";s:8:"cancello";s:8:"cancelli";s:5:"clima";s:5:"clima";s:4:"door";s:5:"porte";s:3:"led";s:3:"led";s:5:"light";s:4:"luci";s:7:"scenari";s:7:"scenari";s:6:"socket";s:5:"prese";s:6:"valvle";s:7:"valvole";s:6:"sensor";s:7:"sensori";s:6:"camera";s:10:"telecamere";s:6:"window";s:8:"finestre";s:4:"user";s:4:"user";s:4:"none";s:26:"verifica_comandi_controlli";s:5:"phone";s:8:"telefono";s:5:"index";s:4:"Home";s:4:"gate";s:8:"cancelli";}}
\ No newline at end of file
......@@ -31,3 +31,6 @@ exten => _[a-z].,1,AGI(agi://${AGIHOST}:${AGIPORT}/internal)
exten => _[a-z].,n,Goto(domotika_out,${EXTEN},1)
exten => _[A-Z].,1,AGI(agi://${AGIHOST}:${AGIPORT}/internal)
exten => _[A-Z].,n,Goto(domotika_out,${EXTEN},1)
exten => _+.,1,AGI(agi://${AGIHOST}:${AGIPORT}/internal)
exten => _+.,n,Goto(domotika_out,${EXTEN},1)
......@@ -27,3 +27,6 @@ exten => _[a-z].,1,Dial(SIP/pstn/${EXTEN},,r)
exten => _[a-z].,n,Hangup()
exten => _X.,1,Dial(SIP/pstn/${EXTEN},,r)
exten => _X.,n,Hangup()
exten => _+39.,1,Dial(SIP/pstn/${EXTEN:3},,r)
exten => _+39.,n,Hangup()
......@@ -28,7 +28,10 @@ from twisted.protocols import basic
import socket, logging, time
from starpy import error, fastagi
import os, logging, time, sys
from domotika.clouds.google import tts, speech
#from domotika.clouds.google import tts, speech
from domotika.clouds.google import tts as googletts
from domotika.clouds.google import speech
from domotika.clouds.responsivevoice import tts
import tempfile
from txscheduling.cron import CronSchedule, parseCronLine
from dmlib.utils import genutils
......@@ -290,7 +293,11 @@ class DMSayText(BaseCheck):
return self.play(saytext, replay,
".".join(playfile.split(".")[:-1]), ".".join(playfile.split(".")[-1:]))
if engine=='google':
gtts=tts.TTS(saytext, tlang)
gtts=googletts.TTS(saytext, tlang)
playfile=tempfile.mktemp(prefix="googletts-", suffix=".sln")
return gtts.convertAudioFile(fdst=playfile).addCallback(_converted, playfile)
elif engine=="responsivevoice":
gtts=tts.TTS(saytext, tlang)
playfile=tempfile.mktemp(prefix="googletts-", suffix=".sln")
return gtts.convertAudioFile(fdst=playfile).addCallback(_converted, playfile)
else:
......
......@@ -29,7 +29,7 @@ from twisted.internet import defer
from twisted.internet import utils as twutils
import os
TTSURI="http://translate.google.com/translate_tts"
TTSURI="https://translate.google.com/translate_tts"
def getSampleRate(fname):
ext=fname.split(".")[-1:]
......@@ -42,13 +42,14 @@ def getSampleRate(fname):
class TTS(object):
agent="Mozilla/5.0 (X11; Linux; rv:8.0) Gecko/20100101"
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.6 Safari/537.36"
def __init__(self, text, lang="it"):
self.text = urllib.quote(text.encode('utf8', 'ignore'))
self.audiourl = TTSURI+"?tl="+lang+"&q="+self.text
def getAudio(self):
print "get", self.audiourl
return web.getPage(self.audiourl, agent=self.agent)
def saveAudioFile(self, nfile=False, raw=True):
......@@ -56,6 +57,7 @@ class TTS(object):
nfile=tempfile.mktemp(prefix="googletts-", suffix=".mp3")
def saveFile(fcont):
print "tornato"
f=open(nfile, "w")
f.write(fcont)
f.close()
......
......@@ -792,6 +792,10 @@ def initializeAutoDetection():
def checkSpeechActions(speech):
return SpeechActions.find(where=['speech_string=? AND active>0', speech])
def getOtherSpeech(speech):
s=speech.replace(" ","%")+"%"
def insertNotify(source, user, msg, expire=0):
n=Notifications()
n.source=source
......
......@@ -1326,7 +1326,7 @@ class domotikaService(service.Service):
if(len(command)>1):
opts=command[1]
for opt in opts.split(','):
optp=opt.split('=')[0]
optp=opt.split('=')
if len(optp)>1 and optp[0] in topt.keys():
optk=optp[0]
optv=optp[1]
......
......@@ -15,4 +15,5 @@ if [ "$2" != "en" ] && [ "$2" != "it" ] ; then
phelp
fi
python `dirname $0`/../domotika/clouds/google/tts.py $1 $2 "${3}"
#python `dirname $0`/../domotika/clouds/google/tts.py $1 $2 "${3}"
python `dirname $0`/../domotika/clouds/responsivevoice/tts.py $1 $2 "${3}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment