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