This commit is contained in:
deathbybandaid 2020-12-16 15:30:05 -05:00
parent f95a4923c6
commit 0c00aa2da1
2 changed files with 16 additions and 10 deletions

View File

@ -11,10 +11,6 @@ class OriginChannels():
self.base_api_url = "https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3" self.base_api_url = "https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3"
self.base_station_url = "https://ott-stationselection.sinclairstoryline.com/stationSelectionByAllStates" self.base_station_url = "https://ott-stationselection.sinclairstoryline.com/stationSelectionByAllStates"
"https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3/channels/stirr?station=abc3340"
"https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3/status/40b80f75-2efc-49af-813b-2a674e69ea59"
def get_channels(self): def get_channels(self):
channel_list = [] channel_list = []

View File

@ -1,3 +1,4 @@
import datetime
class OriginEPG(): class OriginEPG():
@ -20,13 +21,16 @@ class OriginEPG():
epg_json = epg_opn.json() epg_json = epg_opn.json()
for listing in epg_json["channel"][0]["programme"]: for listing in epg_json["channel"][0]["programme"]:
timestampdict = self.stirr_time_convert(listing["start"], listing["stop"])
clean_prog_dict = { clean_prog_dict = {
"time_start": None, "time_start": timestampdict["start"],
"time_end": None, "time_end": timestampdict["end"],
"duration_minutes": None, "duration_minutes": timestampdict["duration"],
"title": "Unavailable", "title": listing["title"]["value"],
"sub-title": "Unavailable", "sub-title": "Unavailable",
"description": "Unavailable", "description": listing["desc"]["value"],
"rating": "N/A", "rating": "N/A",
"episodetitle": None, "episodetitle": None,
"releaseyear": None, "releaseyear": None,
@ -34,7 +38,7 @@ class OriginEPG():
"seasonnumber": None, "seasonnumber": None,
"episodenumber": None, "episodenumber": None,
"isnew": False, "isnew": False,
"id": None, "id": "%s_%s" % (chan_obj.dict["origin_id"], timestampdict['time_start']),
"thumbnail": None "thumbnail": None
} }
@ -42,3 +46,9 @@ class OriginEPG():
programguide[str(chan_obj.number)]["listing"].append(clean_prog_dict) programguide[str(chan_obj.number)]["listing"].append(clean_prog_dict)
return programguide return programguide
def stirr_time_convert(self, starttime, endtime):
starttime = datetime.datetime.strptime(str(starttime), "%Y%m%d%H%M%S").timestamp()
endtime = datetime.datetime.strptime(str(endtime), "%Y%m%d%H%M%S").timestamp()
duration = (endtime - starttime) / 60
return {"start": starttime, "end": endtime, "duration": duration}