mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-23 19:53:28 +00:00
Strict_Time Commercial Fix
Users pointed out that there was an issue where the strict_time entries were still creating 24 hr sets of commercials. This issue has been fixed; if there is an issue of overlap with strict time, no commercials will be played as expected.
This commit is contained in:
@@ -719,7 +719,8 @@ class PseudoChannel():
|
|||||||
if self.USING_COMMERCIAL_INJECTION:
|
if self.USING_COMMERCIAL_INJECTION:
|
||||||
list_of_commercials = self.commercials.get_commercials_to_place_between_media(
|
list_of_commercials = self.commercials.get_commercials_to_place_between_media(
|
||||||
previous_episode,
|
previous_episode,
|
||||||
entry
|
entry,
|
||||||
|
entry.is_strict_time.lower()
|
||||||
)
|
)
|
||||||
for commercial in list_of_commercials:
|
for commercial in list_of_commercials:
|
||||||
self.db.add_media_to_daily_schedule(commercial)
|
self.db.add_media_to_daily_schedule(commercial)
|
||||||
@@ -746,7 +747,8 @@ class PseudoChannel():
|
|||||||
if self.USING_COMMERCIAL_INJECTION:
|
if self.USING_COMMERCIAL_INJECTION:
|
||||||
list_of_commercials = self.commercials.get_commercials_to_place_between_media(
|
list_of_commercials = self.commercials.get_commercials_to_place_between_media(
|
||||||
previous_episode,
|
previous_episode,
|
||||||
entry
|
entry,
|
||||||
|
entry.is_strict_time.lower()
|
||||||
)
|
)
|
||||||
for commercial in list_of_commercials:
|
for commercial in list_of_commercials:
|
||||||
self.db.add_media_to_daily_schedule(commercial)
|
self.db.add_media_to_daily_schedule(commercial)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class PseudoChannelCommercial():
|
|||||||
commercial = tuple(commercial_as_list)
|
commercial = tuple(commercial_as_list)
|
||||||
return commercial
|
return commercial
|
||||||
|
|
||||||
def get_commercials_to_place_between_media(self, last_ep, now_ep):
|
def get_commercials_to_place_between_media(self, last_ep, now_ep, strict_time):
|
||||||
|
|
||||||
prev_item_end_time = datetime.strptime(last_ep.end_time.strftime('%Y-%m-%d %H:%M:%S.%f'), '%Y-%m-%d %H:%M:%S.%f')
|
prev_item_end_time = datetime.strptime(last_ep.end_time.strftime('%Y-%m-%d %H:%M:%S.%f'), '%Y-%m-%d %H:%M:%S.%f')
|
||||||
curr_item_start_time = datetime.strptime(now_ep.start_time, '%I:%M:%S %p')
|
curr_item_start_time = datetime.strptime(now_ep.start_time, '%I:%M:%S %p')
|
||||||
@@ -55,7 +55,7 @@ class PseudoChannelCommercial():
|
|||||||
|
|
||||||
prev_item_end_time = prev_item_end_time.replace(day=1)
|
prev_item_end_time = prev_item_end_time.replace(day=1)
|
||||||
|
|
||||||
if prev_item_end_time.replace(second=0,microsecond=0) > curr_item_start_time:
|
if prev_item_end_time.replace(second=0,microsecond=0) > curr_item_start_time and strict_time == "false":
|
||||||
# NOTE: This is just for the logic of this function, I have noticed that this
|
# NOTE: This is just for the logic of this function, I have noticed that this
|
||||||
# may cause other issues in other functions, since now the day is off.
|
# may cause other issues in other functions, since now the day is off.
|
||||||
print "WE MUST BE SKIPPING A DAY, ADDING A DAY TO THE START TIME"
|
print "WE MUST BE SKIPPING A DAY, ADDING A DAY TO THE START TIME"
|
||||||
|
|||||||
Reference in New Issue
Block a user