E2OpenPlugins / e2openplugin-OpenWebif

GPL Web Interface for e2stabs
GNU General Public License v3.0
205 stars 226 forks source link

[Request]Include PIcon filename, path or URL in response for /api/getServices #849

Closed ssbmaccom closed 5 years ago

ssbmaccom commented 5 years ago

Hi,

I am using OWIF API to query Bouquets, Services, EPG etc.from Enigma2 STBs. Depending on the PIcon Set installed on the STB it is difficult to get the right Picon from there.

Of course I could partly try to port some OWIF Port to ObjC for use inside my App, but I think it should not be too much effort to include the PIcon name, path or even the URL into the servicelist returned from getServices.

Looks to me, changes in /plugin/controllers/models/services.py and related template files should be sufficient. The PIcon is anyway available when preparing the responses, it is just not used.

Other option would be to expose the getPicon function to the API, then I can get the file name directly with passing the service reference. This would keep the interface compatible.

Thanks in advance

jbleyel commented 5 years ago

The picon path for each service will blow up and slow down the response. Api request are optimized for speed and size. Getpicon for each channel generates too many requests. The python twisted web is not a real webserver.

ssbmaccom commented 5 years ago

The picon file name (URL for retrieval is alway /picon/.png) should usually not be longer (in most cases shorter) than the e2servicereference field in the response. So I do not think it will "blow up" the size of the response. Retrieving Full-EPG Info per service returns a by far longer response. Retrieving the picon file name internally also seems not to be too complex, but performance might be tough, as the internal service is "guessing" the name and then checks the directories if the file with the guessed name exists. Reading from Flash Memory can be a bottleneck. But this internal service is called everywhere for composing HTML, so I assume the info is cached internally - just check the HTML source of Multi-EPG. Getpicon for each channel may of course cause many requests, then also retrieving the file itself is increasing it already. I know, that twisted server is not a real webserver and it causes troubles, when composing the response takes time, especially when the data is converted from JSON to XML. I already queue up the requests and make sure that not too many requests have to be processed at the same time.

Only solution to get around this would be to transfer the source of the internal getpicon function to C/ObjC. The function is querying the file system, which I can't do remotely. So I would need to try with 1. algorithm, when it fails, chose the next one and repeat until I found the file. This will cause even more requests, in worst case 4 or 5 per channel. To get around this I would need to retrieve the list of all installed picon files, parse the existing filenames from the HTML response. Or even download all installed PIcons and check locally. Problem there is performance and disk space on the device (AppleTV, iOS).

Therefore I think either of above options (adding picon file name to getservices OR getpicon service) would be fair.

jbleyel commented 5 years ago

The getpicon function in openwebif is not designed for other usage. There are some limitations.

You don't need any additional info in the request if you use picons with sref file names. Replace : with _ and then open this link /picon/xxx.png to download.

ssbmaccom commented 5 years ago

This is what I am already doing there, but this does not work at all times. Some PIcon Sets use a different naming scheme and esp. for IP-TV it is failing, as the Service Referenz has the same IDs but different URLs added to them. So I look for a more reliable way to get the names. As OWIF already has implemented one I thought it is much better, to extend OWIF instead of re-coding the approach myself (where I do not have access to all data) and may need to run multiple requests until I finally get the picon file name that works. Looks like I have to go this route, which may put much more burdon on the twisted server and more advanced handling in my App.

jbleyel commented 5 years ago

I will check this

ssbmaccom commented 5 years ago

Thanks a lot!!