Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Time laps Setup
- # Run (though terminal)
- # python timeLapsSetup.py
- # cwisbg.com
- import socket
- import os
- import time
- start = time.clock()
- global fileCheck
- #open sockets
- maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- maya.connect(('localhost', 6000))
- def checkFile():
- global fileCheck
- # Check for tracker file
- filePath = (os.path.expanduser("~/Documents/maya/timeLapsTracker.txt"))
- try:
- fileCheck = open(filePath, "r")
- except:
- fileCheck = 0
- # Set up
- importStuff = "import timeLaps\n"+"reload(timeLaps)\n"
- # Track Loop
- picTrack = 0
- i = 0
- xx = 1
- catcher = 0
- fileCheck = 0
- checkFile()
- while fileCheck:
- checkFile()
- takePictureCmd = "timeLaps.takePicture('{0}')\n".format(picTrack)
- sendCofirm = "print 'Confirm Send'\n"
- sendCmd = importStuff + takePictureCmd
- elapsed = (time.clock() - start)
- if elapsed > 1:# Timer
- print (sendCmd)
- maya.send(bytes(sendCmd))
- start = time.clock()
- picTrack += 1
- catcher += 1
- i += 1
- else:
- print ("no timeLaps file")
- maya.close()
Advertisement
Add Comment
Please, Sign In to add comment