|
|
@ -1,4 +1,4 @@ |
|
|
|
#!/usr/bin/python3 |
|
|
|
#!/usr/bin/env python3 |
|
|
|
|
|
|
|
|
|
|
|
import threading |
|
|
|
import threading |
|
|
|
import os |
|
|
|
import os |
|
|
@ -55,6 +55,8 @@ class MiniPlayer(object): |
|
|
|
self.maxPlayNext = 3 |
|
|
|
self.maxPlayNext = 3 |
|
|
|
self.__playNext = [] |
|
|
|
self.__playNext = [] |
|
|
|
self.__running = False |
|
|
|
self.__running = False |
|
|
|
|
|
|
|
self.__anims = {} |
|
|
|
|
|
|
|
self.__anims_remaining = {} |
|
|
|
|
|
|
|
|
|
|
|
def terminate(self): |
|
|
|
def terminate(self): |
|
|
|
self.__running = False |
|
|
|
self.__running = False |
|
|
@ -79,10 +81,16 @@ 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]): |
|
|
|
return self.__playNext.pop(0) |
|
|
|
anim = self.__playNext.pop(0) |
|
|
|
else: |
|
|
|
else: |
|
|
|
files = os.listdir(self.__animDir) |
|
|
|
anims = { os.path.join(dp, fn) for dp, dns, fns in \ |
|
|
|
return random.choice(files) |
|
|
|
os.walk(self.__animDir, followlinks=True) for fn in fns } |
|
|
|
|
|
|
|
if anims != self.__anims or len(self.__anims_remaining) == 0: |
|
|
|
|
|
|
|
self.__anims = anims |
|
|
|
|
|
|
|
self.__anims_remaining = set(anims) |
|
|
|
|
|
|
|
anim = random.sample(self.__anims_remaining, 1)[0] |
|
|
|
|
|
|
|
self.__anims_remaining.remove(anim) |
|
|
|
|
|
|
|
return anim |
|
|
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
def run(self): |
|
|
|
""" |
|
|
|
""" |
|
|
|