Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
domotikad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
domotika
domotikad
Commits
e279ce29
Commit
e279ce29
authored
Sep 30, 2015
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update text2speech to use responsivevoice.org
parent
cba886b0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
7 deletions
+18
-7
domotika.js
Web/htdocs/gui/js/domotika.js
+2
-1
0d149b90e7394297301c90191ae775f0.cache
...translations/cache/0d149b90e7394297301c90191ae775f0.cache
+1
-1
fastagi.py
domotika/asterisk/fastagi.py
+9
-2
tts.py
domotika/clouds/google/tts.py
+4
-2
text2audio
scripts/text2audio
+2
-1
No files found.
Web/htdocs/gui/js/domotika.js
View file @
e279ce29
...
@@ -194,7 +194,8 @@
...
@@ -194,7 +194,8 @@
audio
.
setAttribute
(
'id'
,
'playTTS_audio'
);
audio
.
setAttribute
(
'id'
,
'playTTS_audio'
);
}
}
// XXX BUG: webkit based browsers seems to not work with https:// in <audio>, so, we fix this to http
// 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
.
load
();
audio
.
play
();
audio
.
play
();
return
audio
;
return
audio
;
...
...
Web/htdocs/gui/translations/cache/0d149b90e7394297301c90191ae775f0.cache
View file @
e279ce29
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";}}
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
\ No newline at end of file
domotika/asterisk/fastagi.py
View file @
e279ce29
...
@@ -28,7 +28,10 @@ from twisted.protocols import basic
...
@@ -28,7 +28,10 @@ from twisted.protocols import basic
import
socket
,
logging
,
time
import
socket
,
logging
,
time
from
starpy
import
error
,
fastagi
from
starpy
import
error
,
fastagi
import
os
,
logging
,
time
,
sys
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
import
tempfile
from
txscheduling.cron
import
CronSchedule
,
parseCronLine
from
txscheduling.cron
import
CronSchedule
,
parseCronLine
from
dmlib.utils
import
genutils
from
dmlib.utils
import
genutils
...
@@ -290,6 +293,10 @@ class DMSayText(BaseCheck):
...
@@ -290,6 +293,10 @@ class DMSayText(BaseCheck):
return
self
.
play
(
saytext
,
replay
,
return
self
.
play
(
saytext
,
replay
,
"."
.
join
(
playfile
.
split
(
"."
)[:
-
1
]),
"."
.
join
(
playfile
.
split
(
"."
)[
-
1
:]))
"."
.
join
(
playfile
.
split
(
"."
)[:
-
1
]),
"."
.
join
(
playfile
.
split
(
"."
)[
-
1
:]))
if
engine
==
'google'
:
if
engine
==
'google'
:
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
)
gtts
=
tts
.
TTS
(
saytext
,
tlang
)
playfile
=
tempfile
.
mktemp
(
prefix
=
"googletts-"
,
suffix
=
".sln"
)
playfile
=
tempfile
.
mktemp
(
prefix
=
"googletts-"
,
suffix
=
".sln"
)
return
gtts
.
convertAudioFile
(
fdst
=
playfile
)
.
addCallback
(
_converted
,
playfile
)
return
gtts
.
convertAudioFile
(
fdst
=
playfile
)
.
addCallback
(
_converted
,
playfile
)
...
...
domotika/clouds/google/tts.py
View file @
e279ce29
...
@@ -29,7 +29,7 @@ from twisted.internet import defer
...
@@ -29,7 +29,7 @@ from twisted.internet import defer
from
twisted.internet
import
utils
as
twutils
from
twisted.internet
import
utils
as
twutils
import
os
import
os
TTSURI
=
"http://translate.google.com/translate_tts"
TTSURI
=
"http
s
://translate.google.com/translate_tts"
def
getSampleRate
(
fname
):
def
getSampleRate
(
fname
):
ext
=
fname
.
split
(
"."
)[
-
1
:]
ext
=
fname
.
split
(
"."
)[
-
1
:]
...
@@ -42,13 +42,14 @@ def getSampleRate(fname):
...
@@ -42,13 +42,14 @@ def getSampleRate(fname):
class
TTS
(
object
):
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"
):
def
__init__
(
self
,
text
,
lang
=
"it"
):
self
.
text
=
urllib
.
quote
(
text
.
encode
(
'utf8'
,
'ignore'
))
self
.
text
=
urllib
.
quote
(
text
.
encode
(
'utf8'
,
'ignore'
))
self
.
audiourl
=
TTSURI
+
"?tl="
+
lang
+
"&q="
+
self
.
text
self
.
audiourl
=
TTSURI
+
"?tl="
+
lang
+
"&q="
+
self
.
text
def
getAudio
(
self
):
def
getAudio
(
self
):
print
"get"
,
self
.
audiourl
return
web
.
getPage
(
self
.
audiourl
,
agent
=
self
.
agent
)
return
web
.
getPage
(
self
.
audiourl
,
agent
=
self
.
agent
)
def
saveAudioFile
(
self
,
nfile
=
False
,
raw
=
True
):
def
saveAudioFile
(
self
,
nfile
=
False
,
raw
=
True
):
...
@@ -56,6 +57,7 @@ class TTS(object):
...
@@ -56,6 +57,7 @@ class TTS(object):
nfile
=
tempfile
.
mktemp
(
prefix
=
"googletts-"
,
suffix
=
".mp3"
)
nfile
=
tempfile
.
mktemp
(
prefix
=
"googletts-"
,
suffix
=
".mp3"
)
def
saveFile
(
fcont
):
def
saveFile
(
fcont
):
print
"tornato"
f
=
open
(
nfile
,
"w"
)
f
=
open
(
nfile
,
"w"
)
f
.
write
(
fcont
)
f
.
write
(
fcont
)
f
.
close
()
f
.
close
()
...
...
scripts/text2audio
View file @
e279ce29
...
@@ -15,4 +15,5 @@ if [ "$2" != "en" ] && [ "$2" != "it" ] ; then
...
@@ -15,4 +15,5 @@ if [ "$2" != "en" ] && [ "$2" != "it" ] ; then
phelp
phelp
fi
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
}
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment