summaryrefslogtreecommitdiffstats
path: root/util/bin
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2014-12-27 22:07:57 +0100
committerlassulus <lass@aidsballs.de>2014-12-27 22:07:57 +0100
commitc89cdaaf2162e12d3f6c277e65054dfb0a893872 (patch)
tree6ce7b9ea54975d333adb781e0d10c046669b271a /util/bin
parentea07d18a79ccf2649568993973c21287708b0f7e (diff)
text2speech.google: add usage
Diffstat (limited to 'util/bin')
-rwxr-xr-xutil/bin/text2speech.google22
1 files changed, 18 insertions, 4 deletions
diff --git a/util/bin/text2speech.google b/util/bin/text2speech.google
index 41b4c172..b732f363 100755
--- a/util/bin/text2speech.google
+++ b/util/bin/text2speech.google
@@ -1,10 +1,24 @@
#!/bin/sh
set -euf
-tl=${TL:="en"}
+TL=${TL:="en"}
-text=$*
+usage(){
+ echo 'TL= can specifiy which language to use, default is "en"'
+ echo 'Example: TL="de" ./text2speech.google "whats up?" | mpv -)'
+ exit 0
+}
-url="http://translate.google.com/translate_tts?ie=UTF-8&tl=$tl"
+text2speech(){
+ text=$*
+ url="http://translate.google.com/translate_tts?ie=UTF-8&tl=$TL"
+
+ curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "q=$text"
+}
+
+if [ $# -eq 0 ]; then
+ usage
+fi
+
+text2speech $*
-curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "q=$text"