2014-02-03 14:48:39 +00:00
|
|
|
import android
|
|
|
|
|
import tweepy
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
droid=android.Android()
|
|
|
|
|
#droid.wakeLockAcquirePartial()
|
2014-02-28 00:37:49 +00:00
|
|
|
CONSUMER_KEY = 'here'
|
|
|
|
|
CONSUMER_SECRET = 'there'
|
|
|
|
|
ACCESS_KEY = 'somewhere'
|
|
|
|
|
ACCESS_SECRET = 'anywhere'
|
2014-02-03 14:48:39 +00:00
|
|
|
|
|
|
|
|
droid.makeToast("Starting Auth")
|
|
|
|
|
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
|
|
|
|
|
droid.makeToast("Starting Authset")
|
|
|
|
|
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
|
|
|
|
|
droid.makeToast("Starting API")
|
|
|
|
|
api = tweepy.API(auth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
picdir = '/sdcard/pbooth/'
|
|
|
|
|
piccount = 1
|
|
|
|
|
|
|
|
|
|
runcontinuous = True
|
|
|
|
|
|
|
|
|
|
while (runcontinuous == True):
|
|
|
|
|
time.sleep(10)
|
|
|
|
|
droid.ttsSpeak("Hello, I'm the robot photo booth! Please show me your QR code")
|
|
|
|
|
code = droid.scanBarcode()
|
|
|
|
|
scan = code.result
|
|
|
|
|
if scan:
|
|
|
|
|
droid.ttsSpeak("Smile! Taking picture now.")
|
|
|
|
|
time.sleep(2)
|
|
|
|
|
pictemp = picdir + str(code[1]['extras']['SCAN_RESULT'])
|
|
|
|
|
pictemp = pictemp + '%05i.jpeg'
|
|
|
|
|
droid.cameraCapturePicture(pictemp % piccount)
|
|
|
|
|
tweet = "@" + code[1]['extras']['SCAN_RESULT'] + " here is your picture. Have a nice day!"
|
2014-02-28 00:37:49 +00:00
|
|
|
api.update_with_media(pictemp % piccount, status=tweet)
|
2014-02-03 14:48:39 +00:00
|
|
|
droid.ttsSpeak("All finished. Your picture has now been tweeted. Thank you")
|
|
|
|
|
time.sleep(5)
|
|
|
|
|
piccount += 1
|
|
|
|
|
|