Created
September 30, 2015 10:32
-
-
Save bugcloud/ce7f5de1623304ac8876 to your computer and use it in GitHub Desktop.
Pepper weather report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from naoqi import ALProxy | |
r = requests.get('http://api.openweathermap.org/data/2.5/forecast?q="Tokyo","Japan"') | |
list = r.json()['list'] | |
today = list[0]['weather'][0]['main'].replace('"', '') | |
tommorow = list[1]['weather'][0]['main'].replace('"', '') | |
s = str("Today, it's a " + today + " day in Tokyo. And tommorow, it will be " + tommorow + ".") | |
tts = ALProxy("ALTextToSpeech", "127.0.0.1", 9559) | |
if tts: | |
tts.setLanguage("English") | |
tts.say(" ".join([s])) | |
tts.setLanguage("Japanese") | |
else: | |
print "tts is not available" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment