This commit is contained in:
deathbybandaid 2020-12-09 16:42:25 -05:00
parent f4dc35de58
commit 304919b3b4
4 changed files with 34 additions and 12 deletions

View File

@ -53,7 +53,13 @@ class Config():
for dir_type in ["alternative_epg", "origin"]:
for file_item in os.listdir(self.internal["paths"][dir_type]):
file_item_path = os.path.join(self.internal["paths"][dir_type], file_item)
file_item_path = pathlib.Path(self.internal["paths"][dir_type]).joinpath(file_item)
if file_item_path.is_dir():
for sub_file_item in os.listdir(file_item_path):
sub_file_item_path = pathlib.Path(file_item_path).joinpath(sub_file_item)
if str(sub_file_item_path).endswith("_conf.json"):
self.read_json_config(sub_file_item_path)
else:
if str(file_item_path).endswith("_conf.json"):
self.read_json_config(file_item_path)

View File

@ -140,6 +140,9 @@ class EPG():
if entry.is_file():
if entry.name[0] != '_' and entry.name.endswith(".py"):
new_epgtype_list.append(str(entry.name[:-3]))
elif entry.is_dir():
if entry.name[0] != '_':
new_epgtype_list.append(str(entry.name))
for method in new_epgtype_list:
self.fhdhr.logger.info("Found %s EPG method." % method)
self.epg_handling[method] = eval("self.alternative_epg.%s.%sEPG(self.fhdhr, self.channels)" % (method, method))

View File

@ -28,6 +28,7 @@ class EPG():
if method == "get":
epgdict = self.fhdhr.device.epg.get_epg(source)
if source in ["blocks", "origin", self.fhdhr.config.dict["main"]["dictpopname"]]:
epgdict = epgdict.copy()
for c in list(epgdict.keys()):
chan_obj = self.fhdhr.device.channels.get_channel_obj("origin_id", epgdict[c]["id"])

View File

@ -38,6 +38,18 @@ class xmlTV():
if method == "get":
epgdict = self.fhdhr.device.epg.get_epg(source)
if source in ["blocks", "origin", self.fhdhr.config.dict["main"]["dictpopname"]]:
epgdict = epgdict.copy()
for c in list(epgdict.keys()):
chan_obj = self.fhdhr.device.channels.get_channel_obj("origin_id", epgdict[c]["id"])
epgdict[chan_obj.dict["number"]] = epgdict.pop(c)
epgdict[chan_obj.dict["number"]]["name"] = chan_obj.dict["name"]
epgdict[chan_obj.dict["number"]]["callsign"] = chan_obj.dict["callsign"]
epgdict[chan_obj.dict["number"]]["number"] = chan_obj.dict["number"]
epgdict[chan_obj.dict["number"]]["id"] = chan_obj.dict["origin_id"]
epgdict[chan_obj.dict["number"]]["thumbnail"] = chan_obj.thumbnail
xmltv_xml = self.create_xmltv(base_url, epgdict, source)
return Response(status=200,