Skip to content

Instantly share code, notes, and snippets.

@bugcloud
Created September 30, 2015 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bugcloud/ce7f5de1623304ac8876 to your computer and use it in GitHub Desktop.
Save bugcloud/ce7f5de1623304ac8876 to your computer and use it in GitHub Desktop.
Pepper weather report
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