def say_business(): global current_business business = random.choice(businesses) businesses.remove(business) current_business = yelp.business(business['id']) furby.say("You should check out %s, it is rated %d stars on Yelp." % (business['name'], int(business['rating'])))
def say_review(): if "reviews" in current_business and current_business['reviews']: review = random.choice(current_business["reviews"]) current_business['reviews'].remove(review) furby.say("%s said: %s" % (review["user"]["name"], review["excerpt"])) else: furby.say("No more reviews for %s. It must be terrible." % current_business['name'])
def Handle(query): global film if "theater" in query or "movie" in query: film = RandomFilmInTheaters() furby.say("Go see %s." % film['title']) elif film and "who" in query or "actor" in query or "star" in query: actor = random.choice(film["abridged_cast"]) furby.say("It's starring %s as %s. %s." % (actor["name"], actor["characters"][0], random.choice(["What a hottie","I don't like them", "I love them", "What a hearthrob", "I'd see that", "LAME", "I'd tap that"]))) elif film and "about" in query: syn = film['synopsis'] ix = syn.index('.') if ix != -1: furby.say(syn[:ix]) else: furby.say(syn[:50]) elif film and "good" in query: furby.say("%s" % RatingOpinion(film["ratings"]["audience_score"])) query = furby.listen_for(additional_words, timeout=30.0) Handle(query)
from furback import furby import tiara import ranomd if __name__ == '__main__': furby.say(tiara.Insult()) if random.choice([True,False]): furby.do(random.choice(["laugh","fart","sneeze"]))
businesses = yelp.search(search, limit=10) current_business = None def say_business(): global current_business business = random.choice(businesses) businesses.remove(business) current_business = yelp.business(business['id']) furby.say("You should check out %s, it is rated %d stars on Yelp." % (business['name'], int(business['rating']))) def say_review(): if "reviews" in current_business and current_business['reviews']: review = random.choice(current_business["reviews"]) current_business['reviews'].remove(review) furby.say("%s said: %s" % (review["user"]["name"], review["excerpt"])) else: furby.say("No more reviews for %s. It must be terrible." % current_business['name']) say_business() while True: furby.say("Want to hear a review or should I find another business?") more = furby.listen_for(["more", "review", "else", "another", "business"], timeout=60) if "more" in more or "else" in more or "another" in more or "business" in more: say_business() elif "review" in more: say_review()
def SayDirections(dirs): for s in dirs[:-1]: furby.say(s) furby.wait(0.5000) furby.wait(0.5000) # wait longer before the joke at the end furby.say(dirs[-1])
from furback import furby ingredients = ["one nine inch pie crust", "eight granny smith apples", "three tablespoons all purpose flour", "one half cup packed brown sugar"] if __name__ == "__main__": furby.say("to make this recipe you will need") for s in ingredients: furby.say(s) furby.wait(0.2) furby.listen_for(["what"], 30) furby.say("Preheat oven to 425 degrees Farenheight. Melt the butter in a saucepan. Stir in flour to form a paste. Add water, white sugar and brown sugar, and bring to a boil. Reduce temperature and let simmer.") furby.listen_for(["what","then","next"], 30) furby.say("Place the bottom crust in your pan. Fill with apples, mounded slightly. Cover with a lattice work crust. Gently pour the sugar and butter liquid over the crust. Pour slowly so that it does not run off.") furby.listen_for(["what","then","next"], 30) furby.say("Bake 15 minutes in the preheated oven. Reduce the temperature to 350 degrees Farenheight. Continue baking for 35 to 45 minutes, until apples are soft.") furby.listen_for(["thank"], 30) furby.do("burp")
from furback import furby furby.say("no, f**k you") furby.wait(1) furby.do("fart")