Commit 6f00a317 authored by Guido van Rossum's avatar Guido van Rossum

Introduced getopt.

Added -d option: print deltas instead of absolute times.
parent b3c493cd
...@@ -3,6 +3,7 @@ from GL import * ...@@ -3,6 +3,7 @@ from GL import *
from DEVICE import * from DEVICE import *
import time import time
import sys import sys
import getopt
class Struct(): pass class Struct(): pass
epoch = Struct() epoch = Struct()
...@@ -43,19 +44,28 @@ def saveframe(name, w, h, tijd, data): ...@@ -43,19 +44,28 @@ def saveframe(name, w, h, tijd, data):
f.close() f.close()
def main(): def main():
if len(sys.argv) > 1: delta = 0
names = sys.argv[1:] opts, names = getopt.getopt(sys.argv[1:], 'd')
else: for opt, arg in opts:
if opt = '-d': delta = 1
if names = []:
names = ['film.video'] names = ['film.video']
for name in names: for name in names:
try:
f, w, h, pf = openvideo(name) f, w, h, pf = openvideo(name)
except:
sys.stderr.write(name + ': cannot open\n')
continue
print name, ':', w, 'x', h, '; pf =', pf print name, ':', w, 'x', h, '; pf =', pf
num = 0 num = 0
try: try:
otijd = 0
while 1: while 1:
try: try:
tijd = loadframe(f, w, h, pf) tijd = loadframe(f, w, h, pf)
print '\t', tijd, if delta: print '\t', tijd-otijd,
else: print '\t', tijd,
otijd = tijd
num = num + 1 num = num + 1
if num % 8 = 0: if num % 8 = 0:
print print
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment