From 87f7c8f74d77e0dfeaace69d67164cc1d7240832 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Mon, 7 Dec 2020 16:36:00 -0500 Subject: [PATCH] Bugfix and More Enhancements --- fHDHR/http/api/epg.py | 10 ++++++++++ fHDHR/http/api/xmltv.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fHDHR/http/api/epg.py b/fHDHR/http/api/epg.py index 26a8040..78d619f 100644 --- a/fHDHR/http/api/epg.py +++ b/fHDHR/http/api/epg.py @@ -28,6 +28,16 @@ class EPG(): if method == "get": epgdict = self.fhdhr.device.epg.get_epg(source) + 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 + epg_json = json.dumps(epgdict, indent=4) return Response(status=200, diff --git a/fHDHR/http/api/xmltv.py b/fHDHR/http/api/xmltv.py index 5457a91..3ff34ba 100644 --- a/fHDHR/http/api/xmltv.py +++ b/fHDHR/http/api/xmltv.py @@ -81,13 +81,13 @@ class xmlTV(): def create_xmltv(self, base_url, epgdict, source): if not epgdict: return self.xmltv_empty() - epgdict.copy() + epgdict = epgdict.copy() out = self.xmltv_headers() if source in ["origin", "blocks", self.fhdhr.config.dict["main"]["dictpopname"]]: for c in list(epgdict.keys()): - chan_obj = self.fhdhr.channels.get_channel_obj("origin_id", c["id"]) + 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"]