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