test
This commit is contained in:
parent
6234bc25bc
commit
5540a7f514
@ -296,10 +296,18 @@ class EPG():
|
|||||||
while True:
|
while True:
|
||||||
for epg_method in self.epg_methods:
|
for epg_method in self.epg_methods:
|
||||||
last_update_time = self.fhdhr.db.get_fhdhr_value("update_time", epg_method)
|
last_update_time = self.fhdhr.db.get_fhdhr_value("update_time", epg_method)
|
||||||
|
updatetheepg = False
|
||||||
if not last_update_time:
|
if not last_update_time:
|
||||||
self.fhdhr.web.session.get(self.epg_update_url)
|
updatetheepg = True
|
||||||
elif time.time() >= (last_update_time + self.sleeptime[epg_method]):
|
elif time.time() >= (last_update_time + self.sleeptime[epg_method]):
|
||||||
self.fhdhr.web.session.get(self.epg_update_url)
|
updatetheepg = True
|
||||||
|
if updatetheepg:
|
||||||
|
try:
|
||||||
|
self.fhdhr.web.session.get(self.epg_update_url, timeout=0.0000000001)
|
||||||
|
except self.fhdhr.web.exceptions.ReadTimeout:
|
||||||
|
pass
|
||||||
|
except self.fhdhr.web.exceptions.ConnectionError as e:
|
||||||
|
self.fhdhr.logger.error("Error updating %s EPG cache: %s" % (epg_method, e))
|
||||||
time.sleep(360)
|
time.sleep(360)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -15,8 +15,6 @@ class OriginChannels():
|
|||||||
|
|
||||||
"https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3/status/40b80f75-2efc-49af-813b-2a674e69ea59"
|
"https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3/status/40b80f75-2efc-49af-813b-2a674e69ea59"
|
||||||
|
|
||||||
"https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3/program/stirr/ott/"
|
|
||||||
|
|
||||||
def get_channels(self):
|
def get_channels(self):
|
||||||
|
|
||||||
channel_list = []
|
channel_list = []
|
||||||
|
|||||||
@ -5,13 +5,40 @@ class OriginEPG():
|
|||||||
def __init__(self, fhdhr):
|
def __init__(self, fhdhr):
|
||||||
self.fhdhr = fhdhr
|
self.fhdhr = fhdhr
|
||||||
|
|
||||||
|
self.base_epg_url = "https://ott-gateway-stirr.sinclairstoryline.com/api/rest/v3/program/stirr/ott/"
|
||||||
|
|
||||||
def update_epg(self, fhdhr_channels):
|
def update_epg(self, fhdhr_channels):
|
||||||
programguide = {}
|
programguide = {}
|
||||||
|
|
||||||
for fhdhr_id in list(fhdhr_channels.list.keys()):
|
for fhdhr_id in list(fhdhr_channels.list.keys()):
|
||||||
chan_obj = fhdhr_channels.list[fhdhr_id]
|
chan_obj = fhdhr_channels.list[fhdhr_id]
|
||||||
|
|
||||||
if str(chan_obj.dict["number"]) not in list(programguide.keys()):
|
if str(chan_obj.number) not in list(programguide.keys()):
|
||||||
programguide[str(chan_obj.dict["number"])] = chan_obj.epgdict
|
programguide[str(chan_obj.number)] = chan_obj.epgdict
|
||||||
|
|
||||||
|
epg_opn = self.fhdhr.web.session.get(self.base_epg_url + str(chan_obj.dict["origin_id"]))
|
||||||
|
epg_json = epg_opn.json()
|
||||||
|
|
||||||
|
for listing in epg_json["channel"][0]["programme"]:
|
||||||
|
clean_prog_dict = {
|
||||||
|
"time_start": None,
|
||||||
|
"time_end": None,
|
||||||
|
"duration_minutes": None,
|
||||||
|
"title": "Unavailable",
|
||||||
|
"sub-title": "Unavailable",
|
||||||
|
"description": "Unavailable",
|
||||||
|
"rating": "N/A",
|
||||||
|
"episodetitle": None,
|
||||||
|
"releaseyear": None,
|
||||||
|
"genres": [],
|
||||||
|
"seasonnumber": None,
|
||||||
|
"episodenumber": None,
|
||||||
|
"isnew": False,
|
||||||
|
"id": None,
|
||||||
|
"thumbnail": None
|
||||||
|
}
|
||||||
|
|
||||||
|
if not any((d['time_start'] == clean_prog_dict['time_start'] and d['id'] == clean_prog_dict['id']) for d in programguide[chan_obj.number]["listing"]):
|
||||||
|
programguide[str(chan_obj.number)]["listing"].append(clean_prog_dict)
|
||||||
|
|
||||||
return programguide
|
return programguide
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user