38 lines
787 B
Python
Executable file
38 lines
787 B
Python
Executable file
#!/usr/bin/python3
|
|
import os
|
|
import time
|
|
import shutil
|
|
|
|
# Set this to False if you want ALL frames to be played. This will cause the video to move at half pace.
|
|
skipFrames = True
|
|
directory = 'lpbm/'
|
|
|
|
totalFrames = len(os.listdir(directory))
|
|
|
|
if skipFrames:
|
|
startFrame=1
|
|
skip=2
|
|
else:
|
|
startFrame=0
|
|
skip=1
|
|
|
|
startTime = time.time()
|
|
|
|
for i in range(startFrame, totalFrames, skip):
|
|
path = os.path.join(directory, str(i)+".lpbm")
|
|
|
|
#print (i)
|
|
with open(path, 'rb') as f:
|
|
pipe = open('/run/g13d/g13-0', 'wb')
|
|
pipe.write(f.read())
|
|
f.close()
|
|
pipe.flush()
|
|
pipe.close()
|
|
#time.sleep(0.0416666666) # :/
|
|
time.sleep(0.083333333) # Can't quite reach 24 fps, so we run at ~12 fps
|
|
|
|
endTime = time.time()
|
|
|
|
duration = endTime - startTime
|
|
print("Stop. Took " + str(duration) + " seconds.")
|