diff options
| -rw-r--r-- | asltool.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/asltool.py b/asltool.py new file mode 100644 index 0000000..dea4c7d --- /dev/null +++ b/asltool.py @@ -0,0 +1,64 @@ +# "To be, or not to be,that is the question" +import sys +import os +import msvcrt +from timeit import timeit as time +from time import clock as clock +shotcount=0 +pauseinterval=[] +shotlist=[] +def metadata(): + global name + name=input("\nenter movie name:\n") + print("press enter to start") + keystroke=str(msvcrt.getch())[-2] + if keystroke=="r": + print("counter begins") + key() +def key(): + clock() + global shotlist + global shotcount + global keystroke + global pauseinterval + keystroke=str(msvcrt.getch())[-2] + if keystroke=="s": + timestamp=clock() + shotcount=shotcount+1 + shotlist.append((shotcount,timestamp)) + key() + elif keystroke=="p": pause() + elif keystroke=="e" : reset() +def pause(): + print("paused") + global pauseinterval + startpause=clock() + startagain=str(msvcrt.getch())[-2] + if startagain=="p": + endpause=clock() + print("restarted") + pauseinterval.append(endpause-startpause) + key() + elif startagain=="e": reset() + else: pass +def reset(): + global totaltime + global ASL + totaltime=clock() + for pausetime in pauseinterval: totaltime=totaltime-pausetime + print(totaltime) + try: + totaltime/shotcount + except ZeroDivisionError: + sys.exit("no shots recorded") + ASL=totaltime/shotcount + print("number of shots=%d"%shotcount) + print("ASL =%fseconds"%ASL) + reportgenerator() +def reportgenerator(): + fileopen=open(r"%s.ASLreport"%name,mode="w") + fileopen.write( + "ASL report for %s \n\n Record Time=%f\n Recorded Shots=%d\n ASL=%f\nShot Timestamps:\n%s"%(name,totaltime,shotcount,ASL,(str(shotdata) for shotdata in shotlist))) + +if __name__=="__main__": + metadata()
\ No newline at end of file |
