commit bf78bb4f429c50fc42c37fcde71e6277300e989b
parent 89e5d3878dd61042c39f9e5e6862294d709602a3
Author: sin <sin@2f30.org>
Date: Tue, 7 Oct 2014 18:02:23 +0100
Add rat-weather-voice
Diffstat:
5 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -1,4 +1,4 @@
-© 2014 sin <sin@2f30.org>
+© 2014 myroslav
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/rat-echo b/rat-echo
@@ -1,4 +1,4 @@
#!/bin/sh
-# Echo script by myroslav
+# Echo script
tail -n0 -f text_out > text_in
diff --git a/rat-remotemic b/rat-remotemic
@@ -1,5 +1,5 @@
#!/bin/sh
-# A simple remote microphone script by myroslav
+# Remote microphone script
while true; do
while grep -q 0 call_pending; do
diff --git a/rat-weather b/rat-weather
@@ -1,6 +1,5 @@
#!/bin/sh
-#
-# Simple weather oracle script by myroslav
+# Weather oracle script
tail -n0 -f text_out | while read line; do
address=${line:17:${#line}} # strip off date time
diff --git a/rat-weather-voice b/rat-weather-voice
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Voice based weather oracle script
+
+tail -n0 -f text_out | while read line; do
+ address=${line:17:${#line}} # strip off date time
+ echo "Predicting weather at $address. Wait a moment and pick up the call!.." > text_in
+ curl -s --get --data-urlencode "query=$address" \
+ http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml | \
+ perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"' | \
+ text2wave | sox -t wav - -r 48000 -c 1 -e signed -b 16 -L -t wav - > call_in
+done