|
|
|
@ -47,8 +47,9 @@ class MiniPlayer(object):
@@ -47,8 +47,9 @@ class MiniPlayer(object):
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
def __init__(self, animDir, output): |
|
|
|
|
def __init__(self, animDir, animExtensions, output): |
|
|
|
|
self.__animDir = animDir |
|
|
|
|
self.__animExtensions = animExtensions |
|
|
|
|
self.__output = output |
|
|
|
|
self.loopTime = 10000 |
|
|
|
|
self.gap = 800 |
|
|
|
@ -85,10 +86,10 @@ class MiniPlayer(object):
@@ -85,10 +86,10 @@ class MiniPlayer(object):
|
|
|
|
|
else: |
|
|
|
|
anims = set() |
|
|
|
|
for dp, dns, fns in os.walk(self.__animDir, followlinks=True): |
|
|
|
|
if os.path.basename(dp).startswith('.'): |
|
|
|
|
continue |
|
|
|
|
for fn in filter(lambda f: not f.startswith('.'), fns): |
|
|
|
|
anims.add(os.path.join(dp, fn)) |
|
|
|
|
for fn in fns: |
|
|
|
|
root, ext = os.path.splitext(fn) |
|
|
|
|
if ext[1:] in self.__animExtensions: |
|
|
|
|
anims.add(os.path.join(dp, fn)) |
|
|
|
|
|
|
|
|
|
if anims != self.__anims or len(self.__anims_remaining) == 0: |
|
|
|
|
self.__anims = anims |
|
|
|
@ -96,6 +97,7 @@ class MiniPlayer(object):
@@ -96,6 +97,7 @@ class MiniPlayer(object):
|
|
|
|
|
anim = random.sample(self.__anims_remaining, 1)[0] |
|
|
|
|
self.__anims_remaining.remove(anim) |
|
|
|
|
|
|
|
|
|
print(anim) |
|
|
|
|
return anim |
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
@ -185,7 +187,7 @@ def main():
@@ -185,7 +187,7 @@ def main():
|
|
|
|
|
print('%s is not a directory' % (animDir)) |
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
p = MiniPlayer(animDir, out) |
|
|
|
|
p = MiniPlayer(animDir, ['bml'], out) |
|
|
|
|
try: |
|
|
|
|
p.run() |
|
|
|
|
except KeyboardInterrupt: |
|
|
|
|