Created
July 31, 2015 12:12
-
-
Save dmpop/6d39f3d64a36abbbb7ba to your computer and use it in GitHub Desktop.
SL4A-based Python script for timelapse photography
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android, time, os | |
droid = android.Android() | |
counter = 1 | |
title = "Number of Photos" | |
droid.dialogCreateAlert(title) | |
photoCount = int(droid.dialogGetInput("Specify number of photos to take:").result) | |
title = "Time interval" | |
droid.dialogCreateAlert(title) | |
interval = int(droid.dialogGetInput("Specify time interval is seconds:").result) | |
destDir = time.strftime("%Y%m%d-%H%M%S", time.localtime()) | |
os.system("mkdir /sdcard/" + destDir) | |
droid.dialogDismiss() | |
while counter <= photoCount: | |
captureTime = time.strftime("%Y%m%d-%H%M%S", time.localtime()) | |
captureLocation = "/sdcard/"+destDir+"/"+str(captureTime)+".jpg" | |
print "Picture taken: "+captureLocation | |
counter = counter + 1 | |
droid.cameraCapturePicture(captureLocation,True) | |
time.sleep(interval) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment