CC-1469: Crossfading support (non-equal power)

-further implementation..
This commit is contained in:
Martin Konecny 2013-03-15 12:50:23 -04:00
parent 2b7ebafa94
commit dd7fc61e23
7 changed files with 83 additions and 49 deletions

View file

@ -32,9 +32,13 @@ class PypoLiqQueue(Thread):
while True:
try:
if time_until_next_play is None:
self.logger.info("waiting indefinitely for schedule")
media_schedule = self.queue.get(block=True)
else:
media_schedule = self.queue.get(block=True, timeout=time_until_next_play)
self.logger.info("waiting %ss until next scheduled item" % \
time_until_next_play)
media_schedule = self.queue.get(block=True, \
timeout=time_until_next_play)
except Empty, e:
#Time to push a scheduled item.
media_item = schedule_deque.popleft()
@ -55,11 +59,15 @@ class PypoLiqQueue(Thread):
for i in keys:
schedule_deque.append(media_schedule[i])
time_until_next_play = self.date_interval_to_seconds(\
keys[0] - datetime.utcnow())
if len(keys):
time_until_next_play = self.date_interval_to_seconds(\
keys[0] - datetime.utcnow())
def is_media_item_finished(self, media_item):
return datetime.utcnow() > media_item['end']
if media_item is None:
return True
else:
return datetime.utcnow() > media_item['end']
def find_available_queue(self):
available_queue = None