|
|
|
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
|
|
|
|
#!/usr/bin/python |
|
|
|
|
#!/usr/bin/python3 |
|
|
|
|
|
|
|
|
|
import threading |
|
|
|
|
import os |
|
|
|
@ -30,9 +30,8 @@ class AnimationLoaderThread(threading.Thread):
@@ -30,9 +30,8 @@ class AnimationLoaderThread(threading.Thread):
|
|
|
|
|
try: |
|
|
|
|
self.__anim = blup.animation.load(self.__filename) |
|
|
|
|
except Exception as e: |
|
|
|
|
print '%s: %s while loading %s' % (self.__class__.__name__, |
|
|
|
|
repr(e), |
|
|
|
|
self.__filename) |
|
|
|
|
print('%s: %s while loading %s' % (self.__class__.__name__, |
|
|
|
|
repr(e), self.__filename)) |
|
|
|
|
self.__error = True |
|
|
|
|
self.__anim = None |
|
|
|
|
|
|
|
|
@ -113,7 +112,8 @@ class MiniPlayer(object):
@@ -113,7 +112,8 @@ class MiniPlayer(object):
|
|
|
|
|
# show a blank frame for some thime |
|
|
|
|
if self.gap > 0 and self.__running: |
|
|
|
|
# TODO: use correct frame size |
|
|
|
|
dim = blup.frame.FrameDimension(18,8,8,3) |
|
|
|
|
#dim = blup.frame.FrameDimension(18,8,8,3) |
|
|
|
|
dim = blup.frame.FrameDimension(22, 16, 256, 3) |
|
|
|
|
self.__output.sendFrame(blup.frame.Frame(dim)) |
|
|
|
|
time.sleep(self.gap / 1000.0) |
|
|
|
|
|
|
|
|
@ -123,14 +123,14 @@ class MiniPlayer(object):
@@ -123,14 +123,14 @@ class MiniPlayer(object):
|
|
|
|
|
|
|
|
|
|
def printUsage(errMsg=None): |
|
|
|
|
if errMsg is not None: |
|
|
|
|
print 'error: %s\n' % (errMsg) |
|
|
|
|
print 'usage: %s [OPTIONS] PATH' % (sys.argv[0]) |
|
|
|
|
print 'where PATH is the directory containing the animations to play' |
|
|
|
|
print 'supported options:' |
|
|
|
|
print ' -o OUTPUT where to output the frames (default: shell)' |
|
|
|
|
print ' --output OUTPUT\n' |
|
|
|
|
print ' -h print this text' |
|
|
|
|
print ' --help' |
|
|
|
|
print('error: %s\n' % (errMsg)) |
|
|
|
|
print('usage: %s [OPTIONS] PATH' % (sys.argv[0])) |
|
|
|
|
print('where PATH is the directory containing the animations to play') |
|
|
|
|
print('supported options:') |
|
|
|
|
print(' -o OUTPUT where to output the frames (default: shell)') |
|
|
|
|
print(' --output OUTPUT\n') |
|
|
|
|
print(' -h print(this text') |
|
|
|
|
print(' --help') |
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
|
try: |
|
|
|
@ -140,13 +140,13 @@ def main():
@@ -140,13 +140,13 @@ def main():
|
|
|
|
|
printUsage(e.msg) |
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
if opts.has_key('--help'): |
|
|
|
|
if '--help' in opts: |
|
|
|
|
printUsage() |
|
|
|
|
sys.exit(0) |
|
|
|
|
|
|
|
|
|
if opts.has_key('-o'): |
|
|
|
|
if '-o' in opts: |
|
|
|
|
output = opts['-o'] |
|
|
|
|
elif opts.has_key('--output'): |
|
|
|
|
elif '--output' in opts: |
|
|
|
|
output = opts['--output'] |
|
|
|
|
else: |
|
|
|
|
output = 'shell' |
|
|
|
@ -154,12 +154,12 @@ def main():
@@ -154,12 +154,12 @@ def main():
|
|
|
|
|
try: |
|
|
|
|
out = blup.output.getOutput(output) |
|
|
|
|
except blup.output.IllegalOutputSpecificationError: |
|
|
|
|
print 'illegal output specification' |
|
|
|
|
print 'available outputs:' |
|
|
|
|
print blup.output.getOutputDescriptions() |
|
|
|
|
print('illegal output specification') |
|
|
|
|
print('available outputs:') |
|
|
|
|
print(blup.output.getOutputDescriptions()) |
|
|
|
|
sys.exit(1) |
|
|
|
|
except Exception as e: |
|
|
|
|
print 'could not initialize output: %s' % (str(e)) |
|
|
|
|
print('could not initialize output: %s' % (str(e))) |
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
if len(args) != 2: |
|
|
|
@ -169,7 +169,7 @@ def main():
@@ -169,7 +169,7 @@ def main():
|
|
|
|
|
animDir = args[1] |
|
|
|
|
|
|
|
|
|
if not os.path.isdir(animDir): |
|
|
|
|
print '%s is not a directory' % (animDir) |
|
|
|
|
print('%s is not a directory' % (animDir)) |
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
p = MiniPlayer(animDir, out) |
|
|
|
|