diff --git a/PseudoChannel.py b/PseudoChannel.py index a3ff7a2..cfd5949 100644 --- a/PseudoChannel.py +++ b/PseudoChannel.py @@ -1027,12 +1027,16 @@ if __name__ == '__main__': now_time = now.time().replace(microsecond=0) - if now_time == time(11,59): + #print time(11,59,00), now_time + + if now_time == time(00,00,00): if pseudo_channel.USING_GOOGLE_CALENDAR: pseudo_channel.update_schedule_from_google_calendar() + sleep(.5) + else: pass diff --git a/src/PseudoChannelCommercial.py b/src/PseudoChannelCommercial.py index bd0fb53..0bb5a7f 100644 --- a/src/PseudoChannelCommercial.py +++ b/src/PseudoChannelCommercial.py @@ -106,6 +106,8 @@ class PseudoChannelCommercial(): time_watch = prev_item_end_time + new_commercial_start_time = prev_item_end_time + print "here", time_diff.seconds while curr_item_start_time > time_watch and (count) < len(self.commercials): @@ -118,9 +120,11 @@ class PseudoChannelCommercial(): new_commercial_milli = int(random_commercial[4]) - commercial_dur_sum += new_commercial_milli + new_commercial_start_time += datetime.timedelta(milliseconds=commercial_dur_sum) - new_commercial_start_time = time_watch + time_watch += datetime.timedelta(milliseconds=commercial_dur_sum) + + commercial_dur_sum += new_commercial_milli new_commercial_end_time = new_commercial_start_time @@ -141,9 +145,7 @@ class PseudoChannelCommercial(): "", # plex_media_id ) - time_watch += datetime.timedelta(milliseconds=commercial_dur_sum) - - if time_diff_milli < commercial_dur_sum or new_commercial_end_time > curr_item_start_time: + if new_commercial_end_time > curr_item_start_time: break