From 724750f7956d6b85e0216f73e86223ac085e6734 Mon Sep 17 00:00:00 2001 From: Justin Emter Date: Tue, 8 Aug 2017 20:34:43 -0700 Subject: [PATCH] Potential fix for the 'sometimes not playing when starting app' bug. --- PseudoChannel.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PseudoChannel.py b/PseudoChannel.py index ebae3de..47493c2 100644 --- a/PseudoChannel.py +++ b/PseudoChannel.py @@ -1085,7 +1085,7 @@ if __name__ == '__main__': if item_time == closest_media: - print "Here", item + print "Line 1088, Here", item elapsed_time = closest_media - now @@ -1094,12 +1094,16 @@ if __name__ == '__main__': # we need to play the content and add an offest if elapsed_time.total_seconds() < 0: + print str("+++++ Queueing up {} to play right away.".format(item[3])).encode('UTF-8') + offset = int(abs(elapsed_time.total_seconds() * 1000)) - print(offset) - pseudo_channel.controller.play(item, daily_schedule, offset) - + + else: + + print "+++++ Not starting any media." + def job_that_executes_once(item, schedulelist): @@ -1172,7 +1176,7 @@ if __name__ == '__main__': go_generate_daily_sched ).tag('daily-update') - trigger_what_should_be_playing_now() + trigger_flag = 1 try: @@ -1180,6 +1184,12 @@ if __name__ == '__main__': schedule.run_pending() sleep(1) + if trigger_flag: + + trigger_what_should_be_playing_now() + + trigger_flag = 0; + except KeyboardInterrupt: print(' Manual break by user')