mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-22 03:03:33 +00:00
Fixed the issue where the daily_sched wasn't generating at midnight.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user