This commit is contained in:
James Devine 2014-02-27 16:37:49 -08:00
parent e32bfc67a3
commit 7f6b7ed079

View file

@ -1,9 +1,3 @@
#tweets a picture at you, based on a scanned QR code containing a twitter handle in plaintext.
#use with the ZXing barcode/QR code reader app, needs to be installed to work
#You will also need to unpack tweepy successfully
#finally, this script was written to run on SL4A within Android, rather than in native python.
#ps don't forget to leave the phone plugged in, otherwise it will run out of battery
import android import android
import tweepy import tweepy
import time import time
@ -11,10 +5,10 @@ import time
droid=android.Android() droid=android.Android()
#droid.wakeLockAcquirePartial() #droid.wakeLockAcquirePartial()
CONSUMER_KEY = 'yourkeyhere' CONSUMER_KEY = 'here'
CONSUMER_SECRET = 'yoursecrethere' CONSUMER_SECRET = 'there'
ACCESS_KEY = 'youraccessthingyhere' ACCESS_KEY = 'somewhere'
ACCESS_SECRET = 'and the secret access thing here' ACCESS_SECRET = 'anywhere'
droid.makeToast("Starting Auth") droid.makeToast("Starting Auth")
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
@ -41,7 +35,7 @@ while (runcontinuous == True):
pictemp = pictemp + '%05i.jpeg' pictemp = pictemp + '%05i.jpeg'
droid.cameraCapturePicture(pictemp % piccount) droid.cameraCapturePicture(pictemp % piccount)
tweet = "@" + code[1]['extras']['SCAN_RESULT'] + " here is your picture. Have a nice day!" tweet = "@" + code[1]['extras']['SCAN_RESULT'] + " here is your picture. Have a nice day!"
api.status_update_with_media(pictemp % piccount, status=tweet) api.update_with_media(pictemp % piccount, status=tweet)
droid.ttsSpeak("All finished. Your picture has now been tweeted. Thank you") droid.ttsSpeak("All finished. Your picture has now been tweeted. Thank you")
time.sleep(5) time.sleep(5)
piccount += 1 piccount += 1