Trying to work out commercial logic / fixed XML error.

This commit is contained in:
Justin Emter
2017-07-25 20:29:59 -07:00
parent 8b2e69fc3e
commit 6aa4207660
2 changed files with 18 additions and 6 deletions

View File

@@ -346,9 +346,7 @@ class PseudoChannel():
overlap_max = time.attrib['overlap-max'] overlap_max = time.attrib['overlap-max']
start_time_unix = datetime.datetime.strptime( start_time_unix = self.translate_time(time.text)
self.translate_time(time.text),
'%I:%M:%S %p').strftime('%Y-%m-%d %H:%M:%S')
print "Adding: ", time.tag, section, time.text, time.attrib['title'] print "Adding: ", time.tag, section, time.text, time.attrib['title']
@@ -403,7 +401,7 @@ class PseudoChannel():
try: try:
return datetime.datetime.strptime(timestr, '%I:%M:%S %p').strftime('%I:%M:%S %p') return datetime.datetime.strptime(timestr, '%I:%M %p').strftime('%I:%M:%S %p')
except ValueError as e: except ValueError as e:
@@ -417,6 +415,16 @@ class PseudoChannel():
pass pass
try:
return datetime.datetime.strptime(timestr, '%H:%M').strftime('%I:%M:%S %p')
except ValueError as e:
pass
return timestr
def time_diff(self, time1,time2): def time_diff(self, time1,time2):
''' '''
* *
@@ -595,7 +603,7 @@ class PseudoChannel():
section, # section_type section, # section_type
next_episode[3], # title next_episode[3], # title
entry[5], # natural_start_time entry[5], # natural_start_time
self.get_end_time_from_duration(entry[5], next_episode[4]), # natural_end_time self.get_end_time_from_duration(self.translate_time(entry[5]), next_episode[4]), # natural_end_time
next_episode[4], # duration next_episode[4], # duration
entry[7], # day_of_week entry[7], # day_of_week
entry[10], # is_strict_time entry[10], # is_strict_time

View File

@@ -99,7 +99,7 @@ class PseudoChannelCommercial():
commercial_dur_sum = 0 commercial_dur_sum = 0
while int(time_diff.total_seconds()) >= commercial_dur_sum and count < len(self.commercials): while int(time_diff.total_seconds()) >= commercial_dur_sum and (count*10000) < len(self.commercials):
random_commercial = self.get_random_commercial() random_commercial = self.get_random_commercial()
@@ -126,6 +126,10 @@ class PseudoChannelCommercial():
"", # plex_media_id "", # plex_media_id
) )
if int(time_diff.total_seconds()) < commercial_dur_sum:
break
commercial_list.append(new_commercial) commercial_list.append(new_commercial)
#print "here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" #print "here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"