Quantcast
Channel: [EN] OpenPLi Third-Party Development
Viewing all articles
Browse latest Browse all 1691

ConditionalShowHide and ServiceInfo Converter

$
0
0

Hello,

 

When I was adding EPG support for serviceapp I noticed that if this service has EPG available, it always showed also subservices icon in InfoBar as if subservices were available.

In fact subservices are not implemented so this is not correct.

 

I found out, that it's happening because after evUpdatedEventInfo is triggered we check in ServiceInfo for subservices, but since subservices are None it sets boolean for this converter to None, then next downstream element in PLi-HD skin is ConditionalShowHide which transforms this boolean from None to True, which sets visibility for Pixmap renderer to True, which results in shown subservices icon when subservices are not implemented.

 

1. We should make sure to set boolean of ServiceInfo to boolean value and not None:

diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py
index 04e0320..3d99ca0 100644
--- a/lib/python/Components/Converter/ServiceInfo.py
+++ b/lib/python/Components/Converter/ServiceInfo.py
@@ -102,12 +102,12 @@ class ServiceInfo(Converter, object):
                        return info.getInfo(iServiceInformation.sAspect) in WIDESCREEN
                elif self.type == self.SUBSERVICES_AVAILABLE:
                        subservices = service.subServices()
-                       return subservices and subservices.getNumberOfSubservices() > 0
+                       return subservices and subservices.getNumberOfSubservices() > 0 or False
                elif self.type == self.HAS_HBBTV:
                        return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
                elif self.type == self.AUDIOTRACKS_AVAILABLE:
                        audio = service.audioTracks()
-                       return audio and audio.getNumberOfTracks() > 1
+                       return audio and audio.getNumberOfTracks() > 1 or False
                elif self.type == self.SUBTITLES_AVAILABLE:
                        subtitle = service and service.subtitle()
                        subtitlelist = subtitle and subtitle.getSubtitleList()

This basically solves the problem.

 

2. Next thing is that in ConditionalShowHide there was added workaround for sources which boolean's value is None to transform it to True to avoid crash.

https://github.com/OpenPLi/enigma2/commit/20706bda37359411c6e53600763bdcbf8bc0ea53

 

Problem is that this workaround for me for unknown reason returns True for None value, also it doesn't respect invert setting.

 

 a] We can fix this by transforming None to False, while invert setting is respected:

diff --git a/lib/python/Components/Converter/ConditionalShowHide.py b/lib/python/Components/Converter/ConditionalShowHi
de.py
index 246fed2..fbccc61 100644
--- a/lib/python/Components/Converter/ConditionalShowHide.py
+++ b/lib/python/Components/Converter/ConditionalShowHide.py
@@ -33,7 +33,7 @@ class ConditionalShowHide(Converter, object):
        def calcVisibility(self):
                b = self.source.boolean
                if b is None:
-                       return True
+                       b = False
                b ^= self.invert
                return b

b] We can remove this workaround, but we would have to fix every element which could be used with ConditionalShowHide and it's boolean returns None otherwise we would have crashes.

c] Don't do anything and make sure that source's boolean is boolean value.

 

I think the first case patch should be OK, In second case I think we should fix workaround a] since b] could potentially bring down custom Elements which we cannot fix. c] option is also good since it's safe if some Elements rely on this behavior and we can fix errors as they appear, maybe show some warning in case boolean value is None?


Viewing all articles
Browse latest Browse all 1691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>