From b14843d6de8d22e436463d2452f2f5c98a8da987 Mon Sep 17 00:00:00 2001 From: Neereja Sundaresan Date: Tue, 17 Jan 2012 23:36:43 -0500 Subject: [PATCH 1/2] facebook test --- facebooktest.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 facebooktest.py diff --git a/facebooktest.py b/facebooktest.py new file mode 100755 index 0000000..fa6595b --- /dev/null +++ b/facebooktest.py @@ -0,0 +1,11 @@ +#!/usr/bin/python + +from urllib import urlretrieve +import imp +urlretrieve('https://raw.github.com/gist/1194123/fbconsole.py', '.fbconsole.py') +fb = imp.load_source('fb', '.fbconsole.py') + +fb.AUTH_SCOPE = ['publish_stream'] +fb.authenticate() + +status = fb.graph_post("/me/feed", {"message": "Hello from python"}) From ec92c880b262d100ed533a2c4ebe8380a8e567e4 Mon Sep 17 00:00:00 2001 From: Neereja Sundaresan Date: Tue, 17 Jan 2012 23:59:10 -0500 Subject: [PATCH 2/2] Adding clock.py --- clock.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 clock.py diff --git a/clock.py b/clock.py new file mode 100755 index 0000000..42ca1e2 --- /dev/null +++ b/clock.py @@ -0,0 +1,41 @@ +#!/usr/bin/python + +import time +import freenect +import os + +# clock.py + +from urllib import urlretrieve +import imp +urlretrieve('https://raw.github.com/gist/1194123/fbconsole.py', '.fbconsole.py') +fb = imp.load_source('fb', '.fbconsole.py') + +fb.AUTH_SCOPE = ['publish_stream'] +fb.authenticate() + +print "Welcome to the Embarrass-You-Awake-inator!" + +now = list(time.localtime()) +print "The current time is %(hour)d:%(min)02d:%(sec)02d" % {"hour": now[3], "min": now[4], "sec": now[5]} +print "Please enter the time you want to wake up: " +hour = input("Hour: (0-23) ") +min = input("Minute: (0-59) ") +sec = input("Seconds: (0-59) ") +print "An alarm has been set for %(hour)d:%(min)02d:%(sec)02d" % {"hour": hour, "min": min, "sec": sec} +print "Sleep, we'll wake you up!" + +wait = 1 +while(wait): + now = list(time.localtime()) + now_hour = now[3] + now_minute = now[4] + now_second = now[5] + if now_hour == hour and now_minute == min and now_second == sec: + os.popen2("open /Users/Neereja/Desktop/19\ The\ resurrection\ stone.mp3") + # Freenect commands to take picture + + # Post picture to Facebook + status = fb.graph_post("/me/feed", {"message": "I overslept"}) + fb.graph_post("/me/photos", {'name': 'I can\'t wake up \:\(', 'source': open("sleepy.jpg")}) + wait = 0 \ No newline at end of file