mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 12:56:57 -05:00
Improve XMLTV
This commit is contained in:
parent
daa5ac92cb
commit
5640ce26a8
@ -38,7 +38,7 @@ class xmlTV():
|
|||||||
if method == "get":
|
if method == "get":
|
||||||
|
|
||||||
epgdict = self.fhdhr.device.epg.get_epg(source)
|
epgdict = self.fhdhr.device.epg.get_epg(source)
|
||||||
xmltv_xml = self.create_xmltv(base_url, epgdict)
|
xmltv_xml = self.create_xmltv(base_url, epgdict, source)
|
||||||
|
|
||||||
return Response(status=200,
|
return Response(status=200,
|
||||||
response=xmltv_xml,
|
response=xmltv_xml,
|
||||||
@ -78,12 +78,23 @@ class xmlTV():
|
|||||||
"""This method is called when creation of a full xmltv is not possible"""
|
"""This method is called when creation of a full xmltv is not possible"""
|
||||||
return self.xmltv_file(self.xmltv_headers())
|
return self.xmltv_file(self.xmltv_headers())
|
||||||
|
|
||||||
def create_xmltv(self, base_url, epgdict):
|
def create_xmltv(self, base_url, epgdict, source):
|
||||||
if not epgdict:
|
if not epgdict:
|
||||||
return self.xmltv_empty()
|
return self.xmltv_empty()
|
||||||
|
epgdict.copy()
|
||||||
|
|
||||||
out = self.xmltv_headers()
|
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"])
|
||||||
|
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
|
||||||
|
|
||||||
for c in list(epgdict.keys()):
|
for c in list(epgdict.keys()):
|
||||||
|
|
||||||
c_out = sub_el(out, 'channel', id=str(epgdict[c]['number']))
|
c_out = sub_el(out, 'channel', id=str(epgdict[c]['number']))
|
||||||
@ -95,13 +106,10 @@ class xmlTV():
|
|||||||
sub_el(c_out, 'display-name', text=epgdict[c]['callsign'])
|
sub_el(c_out, 'display-name', text=epgdict[c]['callsign'])
|
||||||
sub_el(c_out, 'display-name', text=epgdict[c]['name'])
|
sub_el(c_out, 'display-name', text=epgdict[c]['name'])
|
||||||
|
|
||||||
if epgdict[c]["thumbnail"] is not None:
|
|
||||||
if self.fhdhr.config.dict["epg"]["images"] == "proxy":
|
if self.fhdhr.config.dict["epg"]["images"] == "proxy":
|
||||||
sub_el(c_out, 'icon', src=(str(base_url) + "/api/images?method=get&type=channel&id=" + str(epgdict[c]['id'])))
|
sub_el(c_out, 'icon', src=(str(base_url) + "/api/images?method=get&type=channel&id=" + str(epgdict[c]['id'])))
|
||||||
else:
|
else:
|
||||||
sub_el(c_out, 'icon', src=(epgdict[c]["thumbnail"]))
|
sub_el(c_out, 'icon', src=(epgdict[c]["thumbnail"]))
|
||||||
else:
|
|
||||||
sub_el(c_out, 'icon', src=(str(base_url) + "/api/images?method=generate&type=channel&message=" + urllib.parse.quote(epgdict[c]['name'])))
|
|
||||||
|
|
||||||
for channelnum in list(epgdict.keys()):
|
for channelnum in list(epgdict.keys()):
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user