This commit is contained in:
deathbybandaid 2020-12-10 16:00:02 -05:00
parent ce07510586
commit 7d50331bfc
2 changed files with 32 additions and 3 deletions

View File

@ -74,7 +74,25 @@ class EPG():
epgitem = epgdict[channel_number].copy() epgitem = epgdict[channel_number].copy()
epgitem["listing"] = [listing] epgitem["listing"] = [listing]
return epgitem return epgitem
return None epgitem = epgdict[channel_number].copy()
epgitem["listing"] = [{
"time_start": None,
"time_end": None,
"duration_minutes": None,
"thumbnail": None,
"title": "Unavailable",
"sub-title": "Unavailable",
"description": "Unavailable",
"rating": "N/A",
"episodetitle": None,
"releaseyear": None,
"genres": [],
"seasonnumber": None,
"episodenumber": None,
"isnew": False,
"id": None,
}]
return epgitem
def whats_on_allchans(self, method=None): def whats_on_allchans(self, method=None):
@ -181,6 +199,14 @@ class EPG():
for cnum in programguide: for cnum in programguide:
programguide[cnum]["listing"] = sorted(programguide[cnum]["listing"], key=lambda i: i['time_start']) programguide[cnum]["listing"] = sorted(programguide[cnum]["listing"], key=lambda i: i['time_start'])
if method in ["blocks", "origin", self.fhdhr.config.dict["main"]["dictpopname"]]:
for fhdhr_id in list(self.channels.list.keys()):
chan_obj = self.channels.list[fhdhr_id]
if str(chan_obj.number) not in list(programguide.keys()):
programguide[str(chan_obj.number)] = chan_obj.epgdict
self.epgdict = programguide self.epgdict = programguide
self.fhdhr.db.set_fhdhr_value("epg_dict", method, programguide) self.fhdhr.db.set_fhdhr_value("epg_dict", method, programguide)
self.fhdhr.db.set_fhdhr_value("update_time", method, time.time()) self.fhdhr.db.set_fhdhr_value("update_time", method, time.time())

View File

@ -26,8 +26,11 @@ class Guide_HTML():
source = self.fhdhr.device.epg.def_method source = self.fhdhr.device.epg.def_method
for channel in self.fhdhr.device.epg.whats_on_allchans(source): for channel in self.fhdhr.device.epg.whats_on_allchans(source):
if channel["listing"][0]["time_end"]:
end_time = datetime.datetime.strptime(channel["listing"][0]["time_end"], '%Y%m%d%H%M%S +0000') end_time = datetime.datetime.strptime(channel["listing"][0]["time_end"], '%Y%m%d%H%M%S +0000')
remaining_time = humanized_time(int((end_time - nowtime).total_seconds())) remaining_time = humanized_time(int((end_time - nowtime).total_seconds()))
else:
remaining_time = "N/A"
chan_dict = { chan_dict = {
"name": channel["name"], "name": channel["name"],