View Full Version : [ViX_Misc] OpenWebif issue
Expanding a bouquet of TV channels (when EPG is not loaded - for instance a DVB-T bouquet) the following exception is thrown:
(bouquet is not expanded, "loading..." message remains on the screen)
< 1488.547> Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/twisted/protocols/basic.py", line 571, in dataReceived
File "/usr/lib/python2.7/site-packages/twisted/web/http.py", line 1752, in lineReceived
File "/usr/lib/python2.7/site-packages/twisted/web/http.py", line 1845, in allContentReceived
File "/usr/lib/python2.7/site-packages/twisted/web/http.py", line 766, in requestReceived
--- <exception caught here> ---
File "/usr/lib/python2.7/site-packages/twisted/web/server.py", line 190, in process
File "/usr/lib/python2.7/site-packages/twisted/web/server.py", line 241, in render
File "/usr/lib/enigma2/python/Plugins/Extensions/OpenWebif/controllers/base.py", line 123, in render
data = func(request)
File "/usr/lib/enigma2/python/Plugins/Extensions/OpenWebif/controllers/ajax.py", line 67, in P_channels
channels = getChannels(idbouquet, stype)
File "/usr/lib/enigma2/python/Plugins/Extensions/OpenWebif/controllers/models/services.py", line 367, in getChannels
chan['next_end'] = strftime("%H:%M",(localtime(nextevent[0][1] + nextevent[0][2])))
exceptions.TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
Expanding a bouquet of TV channels (when EPG is not loaded - for instance a DVB-T bouquet)Could you expand on what you mean by "EPG is not loaded"?
(The actual problem seems to be that there is a now event, but not a next one. There's a check for the former existing but not the latter).
Actually it seems EPG is there, for one channel "next_end" and "next_duration" are not set.
54065
I changed the code like this:
root@vuduo2:/usr/lib/enigma2/python/Plugins/Extensions/OpenWebif/controllers/models$ diff services.py_orig services.py
--- services.py_orig
+++ services.py
@@ -364,8 +364,12 @@
nextevent = epgcache.lookupEvent(['TBDIX', (channel[0], +1, -1)])
chan['next_title'] = filterName(nextevent[0][0])
chan['next_begin'] = strftime("%H:%M", (localtime(nextevent[0][1])))
- chan['next_end'] = strftime("%H:%M",(localtime(nextevent[0][1] + nextevent[0][2])))
- chan['next_duration'] = int(nextevent[0][2] / 60)
+ if len(nextevent) > 0 and nextevent[0][0] is not None:
+ chan['next_end'] = strftime("%H:%M",(localtime(nextevent[0][1] + nextevent[0][2])))
+ chan['next_duration'] = int(nextevent[0][2] / 60)
+ else:
+ chan['next_end'] = None
+ chan['next_duration'] = None
chan['next_ev_id'] = nextevent[0][3]
chan['next_idp'] = "nextd" + str(idp)
idp += 1
Could you expand on what you mean by "EPG is not loaded"?
(The actual problem seems to be that there is a now event, but not a next one. There's a check for the former existing but not the latter).
You are right, the entire "nextevent" is not there.
I only added the check for the two fields triggering the exception but we need a proper fix in place.
Assuming that your problem is what I think it is, I have a fix.
But since I can't reproduce a situation that has a now event but not a next one (except artificially) I'm not certain that it will fix what you have seen.
Mind you, in the process I've come across an additonal bug in OpenWebIF. It should be html-escaping the programme title (and channel name), but it isn't. As I discovered when trying to set a dummy title of "<<absent>>" and ending up with just "<>" displayed.
I only added the check for the two fields triggering the exception but we need a proper fix in place.Try this?
54066
No, don't. I've just read your post and it needs a finer set of tests....
OK, try this one.
54067
It (should) handle missing the next event having a missing begin or duration. It also handles there being no next event at all (the rest of the OWI code expects to find some...).
Now I'm going to look at html-escaping titles....
Can of worms here!
I've now found another bug (with URL unquoting) whilst looking for html escaping.
OK, try this one.
54067
It (should) handle missing the next event having a missing begin or duration. It also handles there being no next event at all (the rest of the OWI code expects to find some...).
Now I'm going to look at html-escaping titles....
Thanks, I'll try your fix later on and report back.
Mind you, in the process I've come across an additonal bug in OpenWebIF. It should be html-escaping the programme title (and channel name), but it isn't. As I discovered when trying to set a dummy title of "<<absent>>" and ending up with just "<>" displayed.Hmmm....weird.
I do need to put that string in as html-escaped ( <<absent>> ), but as far as I can see every other instance of text arriving back for display is already escaped. Which makes no sense as the titles being set in services.py certainly are not (I've printed them all out...). Actually, it looks like the title field isn't escaped, but the running text is. And If I change the title to contain "<&> it all gets horribly messed up....
Fortunately there seems to be a simple fix for all relevant fields in this file as they are all fetched via filterName() or convertDesc().
OK. Three PRs.
A call to an undefined function, unescape (should be unquote). That's gone in (and wasn't a problem unless there were tags - just that I noticed it while looking for any uses of "escape").
A fix for missing fields in the next item (what you were suffering):
https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/pull/622
A fix to HTML-escape the title and descriptions (which was what I was falling foul of with the "<<absent>>" string).
https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/pull/623
you've got to love it when something that should be simple to fix turns up 5 other things at the same time and you're sat there wishing you never opened the can :D
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.