|
|
@ -83,13 +83,19 @@ class MiniPlayer(object): |
|
|
|
if len(self.__playNext) > 0 and os.path.isfile(self.__playNext[0]): |
|
|
|
if len(self.__playNext) > 0 and os.path.isfile(self.__playNext[0]): |
|
|
|
anim = self.__playNext.pop(0) |
|
|
|
anim = self.__playNext.pop(0) |
|
|
|
else: |
|
|
|
else: |
|
|
|
anims = { os.path.join(dp, fn) for dp, dns, fns in \ |
|
|
|
anims = set() |
|
|
|
os.walk(self.__animDir, followlinks=True) for fn in fns } |
|
|
|
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)) |
|
|
|
|
|
|
|
|
|
|
|
if anims != self.__anims or len(self.__anims_remaining) == 0: |
|
|
|
if anims != self.__anims or len(self.__anims_remaining) == 0: |
|
|
|
self.__anims = anims |
|
|
|
self.__anims = anims |
|
|
|
self.__anims_remaining = set(anims) |
|
|
|
self.__anims_remaining = set(anims) |
|
|
|
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) |
|
|
|
|
|
|
|
|
|
|
|
return anim |
|
|
|
return anim |
|
|
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
def run(self): |
|
|
@ -105,8 +111,7 @@ class MiniPlayer(object): |
|
|
|
while self.__running: |
|
|
|
while self.__running: |
|
|
|
|
|
|
|
|
|
|
|
# begin to load the next animation |
|
|
|
# begin to load the next animation |
|
|
|
filename = os.path.join(self.__animDir, self.getNextFilename()) |
|
|
|
loader = AnimationLoaderThread(self.getNextFilename()) |
|
|
|
loader = AnimationLoaderThread(filename) |
|
|
|
|
|
|
|
loader.start() |
|
|
|
loader.start() |
|
|
|
|
|
|
|
|
|
|
|
# play the animation in case it had been successfully loaded before |
|
|
|
# play the animation in case it had been successfully loaded before |
|
|
|