diff options
author | Guido van Rossum <guido@python.org> | 1991-11-06 16:13:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-11-06 16:13:02 (GMT) |
commit | 6f00a317a196cc97076e39f1769dd1941bb38fe0 (patch) | |
tree | 1fbf136ac0894fab306e9e3be5e1877ab373d6c1 /Demo | |
parent | b3c493cdd87b6a0f183893e3c5b71844dbb6e995 (diff) | |
download | cpython-6f00a317a196cc97076e39f1769dd1941bb38fe0.zip cpython-6f00a317a196cc97076e39f1769dd1941bb38fe0.tar.gz cpython-6f00a317a196cc97076e39f1769dd1941bb38fe0.tar.bz2 |
Introduced getopt.
Added -d option: print deltas instead of absolute times.
Diffstat (limited to 'Demo')
-rwxr-xr-x | Demo/sgi/video/vinfo.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Demo/sgi/video/vinfo.py b/Demo/sgi/video/vinfo.py index 196a0da..e230c4f 100755 --- a/Demo/sgi/video/vinfo.py +++ b/Demo/sgi/video/vinfo.py @@ -3,6 +3,7 @@ from GL import * from DEVICE import * import time import sys +import getopt class Struct(): pass epoch = Struct() @@ -43,19 +44,28 @@ def saveframe(name, w, h, tijd, data): f.close() def main(): - if len(sys.argv) > 1: - names = sys.argv[1:] - else: + delta = 0 + opts, names = getopt.getopt(sys.argv[1:], 'd') + for opt, arg in opts: + if opt = '-d': delta = 1 + if names = []: names = ['film.video'] for name in names: - f, w, h, pf = openvideo(name) + try: + f, w, h, pf = openvideo(name) + except: + sys.stderr.write(name + ': cannot open\n') + continue print name, ':', w, 'x', h, '; pf =', pf num = 0 try: + otijd = 0 while 1: try: tijd = loadframe(f, w, h, pf) - print '\t', tijd, + if delta: print '\t', tijd-otijd, + else: print '\t', tijd, + otijd = tijd num = num + 1 if num % 8 = 0: print |