diff --git a/fHDHR/origin/origin_epg.py b/fHDHR/origin/origin_epg.py index 0ebc958..c80de07 100644 --- a/fHDHR/origin/origin_epg.py +++ b/fHDHR/origin/origin_epg.py @@ -67,6 +67,10 @@ class OriginEPG(): (self.media_url, schedulename_quote, datestring)) epgguide.extend(self.get_cached(epgname, todaydate, schedule_url)) + offset = '+0000' + if "pst" in c["origin_id"]: + offset = '-0300' + progindex = 0 for program_dict in epgguide: @@ -76,7 +80,7 @@ class OriginEPG(): nextprog_dict = None 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: subtitle = program_dict["name"] @@ -149,17 +153,17 @@ class OriginEPG(): duration = (end_time - start_time).total_seconds() / 60 return duration - def xmltimestamp_toonami(self, inputtime): - xmltime = inputtime.replace('Z', '+00:00') + def xmltimestamp_toonami(self, inputtime, offset): + xmltime = inputtime.replace('Z', offset) xmltime = datetime.datetime.fromisoformat(xmltime) xmltime = xmltime.strftime('%Y%m%d%H%M%S %z') return xmltime - def get_prog_timedict(self, starttime, endtime): + def get_prog_timedict(self, starttime, endtime, offset): timedict = { - "time_start": self.xmltimestamp_toonami(starttime), - "time_end": self.xmltimestamp_toonami(endtime), - "duration": self.toonami_calculate_duration(starttime, endtime) + "time_start": str(self.xmltimestamp_toonami(starttime, offset)), + "time_end": str(self.xmltimestamp_toonami(endtime, offset)), + "duration": str(int(self.toonami_calculate_duration(starttime, endtime))) } print(timedict) return timedict