|
|
@ -12,13 +12,14 @@ def printUsage(errMsg=None): |
|
|
|
print('usage: %s [OPTIONS] FILENAME' % (sys.argv[0])) |
|
|
|
print('usage: %s [OPTIONS] FILENAME' % (sys.argv[0])) |
|
|
|
print('supported options:') |
|
|
|
print('supported options:') |
|
|
|
print(' -o OUTPUT where to output the frames (default: shell)') |
|
|
|
print(' -o OUTPUT where to output the frames (default: shell)') |
|
|
|
|
|
|
|
print(' --no-loop play animation only once') |
|
|
|
print(' --output OUTPUT\n') |
|
|
|
print(' --output OUTPUT\n') |
|
|
|
print(' -h print this text') |
|
|
|
print(' -h print this text') |
|
|
|
print(' --help') |
|
|
|
print(' --help') |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
def main(): |
|
|
|
try: |
|
|
|
try: |
|
|
|
(opts, args) = getopt.gnu_getopt(sys.argv, 'ho:', ['help', 'output=']) |
|
|
|
(opts, args) = getopt.gnu_getopt(sys.argv, 'ho:', ['help', 'output=', 'no-loop']) |
|
|
|
opts = dict(opts) |
|
|
|
opts = dict(opts) |
|
|
|
except getopt.GetoptError as e: |
|
|
|
except getopt.GetoptError as e: |
|
|
|
printUsage(e.msg) |
|
|
|
printUsage(e.msg) |
|
|
@ -35,6 +36,8 @@ def main(): |
|
|
|
else: |
|
|
|
else: |
|
|
|
output = 'shell' |
|
|
|
output = 'shell' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loop = '--no-loop' not in opts |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
out = blup.output.getOutput(output) |
|
|
|
out = blup.output.getOutput(output) |
|
|
|
except blup.output.IllegalOutputSpecificationError: |
|
|
|
except blup.output.IllegalOutputSpecificationError: |
|
|
@ -60,6 +63,8 @@ def main(): |
|
|
|
try: |
|
|
|
try: |
|
|
|
while True: |
|
|
|
while True: |
|
|
|
player.play(anim, out) |
|
|
|
player.play(anim, out) |
|
|
|
|
|
|
|
if not loop: |
|
|
|
|
|
|
|
break |
|
|
|
except KeyboardInterrupt: |
|
|
|
except KeyboardInterrupt: |
|
|
|
sys.exit(0) |
|
|
|
sys.exit(0) |
|
|
|
|
|
|
|
|
|
|
|