test
This commit is contained in:
parent
c66545f63a
commit
895a79315f
@ -67,6 +67,10 @@ class OriginEPG():
|
|||||||
(self.media_url, schedulename_quote, datestring))
|
(self.media_url, schedulename_quote, datestring))
|
||||||
epgguide.extend(self.get_cached(epgname, todaydate, schedule_url))
|
epgguide.extend(self.get_cached(epgname, todaydate, schedule_url))
|
||||||
|
|
||||||
|
offset = '+0000'
|
||||||
|
if "pst" in c["origin_id"]:
|
||||||
|
offset = '-0300'
|
||||||
|
|
||||||
progindex = 0
|
progindex = 0
|
||||||
for program_dict in epgguide:
|
for program_dict in epgguide:
|
||||||
|
|
||||||
@ -76,7 +80,7 @@ class OriginEPG():
|
|||||||
nextprog_dict = None
|
nextprog_dict = None
|
||||||
if nextprog_dict:
|
if nextprog_dict:
|
||||||
|
|
||||||
timedict = self.get_prog_timedict(program_dict["startDate"], nextprog_dict["startDate"])
|
timedict = self.get_prog_timedict(program_dict["startDate"], nextprog_dict["startDate"], offset)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subtitle = program_dict["name"]
|
subtitle = program_dict["name"]
|
||||||
@ -149,17 +153,17 @@ class OriginEPG():
|
|||||||
duration = (end_time - start_time).total_seconds() / 60
|
duration = (end_time - start_time).total_seconds() / 60
|
||||||
return duration
|
return duration
|
||||||
|
|
||||||
def xmltimestamp_toonami(self, inputtime):
|
def xmltimestamp_toonami(self, inputtime, offset):
|
||||||
xmltime = inputtime.replace('Z', '+00:00')
|
xmltime = inputtime.replace('Z', offset)
|
||||||
xmltime = datetime.datetime.fromisoformat(xmltime)
|
xmltime = datetime.datetime.fromisoformat(xmltime)
|
||||||
xmltime = xmltime.strftime('%Y%m%d%H%M%S %z')
|
xmltime = xmltime.strftime('%Y%m%d%H%M%S %z')
|
||||||
return xmltime
|
return xmltime
|
||||||
|
|
||||||
def get_prog_timedict(self, starttime, endtime):
|
def get_prog_timedict(self, starttime, endtime, offset):
|
||||||
timedict = {
|
timedict = {
|
||||||
"time_start": self.xmltimestamp_toonami(starttime),
|
"time_start": str(self.xmltimestamp_toonami(starttime, offset)),
|
||||||
"time_end": self.xmltimestamp_toonami(endtime),
|
"time_end": str(self.xmltimestamp_toonami(endtime, offset)),
|
||||||
"duration": self.toonami_calculate_duration(starttime, endtime)
|
"duration": str(int(self.toonami_calculate_duration(starttime, endtime)))
|
||||||
}
|
}
|
||||||
print(timedict)
|
print(timedict)
|
||||||
return timedict
|
return timedict
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user