Remove 2 second sleep after pushing to Liquidsoap queue
This commit is contained in:
parent
8d5de1025e
commit
6f3b1bc7c2
1 changed files with 8 additions and 6 deletions
|
@ -57,6 +57,7 @@ class PypoPush(Thread):
|
|||
next_media_item_chain = None
|
||||
media_schedule = None
|
||||
time_until_next_play = None
|
||||
chains = None
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
@ -65,10 +66,11 @@ class PypoPush(Thread):
|
|||
else:
|
||||
media_schedule = self.queue.get(block=True, timeout=time_until_next_play)
|
||||
|
||||
chains = self.get_all_chains(media_schedule)
|
||||
|
||||
#We get to the following lines only if a schedule was received.
|
||||
liquidsoap_queue_approx = self.get_queue_items_from_liquidsoap()
|
||||
|
||||
chains = self.get_all_chains(media_schedule)
|
||||
current_event_chain = self.get_current_chain(chains)
|
||||
if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0:
|
||||
#Something is scheduled but Liquidsoap is not playing anything!
|
||||
|
@ -79,8 +81,10 @@ class PypoPush(Thread):
|
|||
else:
|
||||
media_chain = filter(lambda item: (item["type"] == "file"), current_event_chain)
|
||||
self.handle_new_media_schedule(media_schedule, liquidsoap_queue_approx, media_chain)
|
||||
chains = self.get_all_chains(media_schedule)
|
||||
|
||||
#chains = self.get_all_chains(media_schedule)
|
||||
next_media_item_chain = self.get_next_schedule_chain(chains)
|
||||
|
||||
self.logger.debug("Next schedule chain: %s", next_media_item_chain)
|
||||
if next_media_item_chain is not None:
|
||||
tnow = datetime.utcnow()
|
||||
|
@ -94,10 +98,8 @@ class PypoPush(Thread):
|
|||
#We only get here when a new chain of tracks are ready to be played.
|
||||
self.push_to_liquidsoap(next_media_item_chain)
|
||||
|
||||
#TODO
|
||||
time.sleep(2)
|
||||
chains.remove(next_media_item_chain)
|
||||
|
||||
chains = self.get_all_chains(media_schedule)
|
||||
next_media_item_chain = self.get_next_schedule_chain(chains)
|
||||
if next_media_item_chain is not None:
|
||||
tnow = datetime.utcnow()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue