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