Skip to content

Commit

Permalink
HideVBI: Change from service flag to whitelist_vbi
Browse files Browse the repository at this point in the history
Now also on internet screens the VBI lines are rememebered and also when
when rescan services they are also remembered.

TODO: The flag '512' can be used in futere by a futere feature and we
might need to add something that removes not existing services (the same
need to be done for the parental backlist)
  • Loading branch information
littlesat committed Oct 18, 2018
1 parent 54d7841 commit 3add870
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
18 changes: 5 additions & 13 deletions lib/python/Screens/ChannelSelection.py
Expand Up @@ -47,7 +47,6 @@

FLAG_SERVICE_NEW_FOUND = 64
FLAG_IS_DEDICATED_3D = 128
FLAG_HIDE_VBI = 512
FLAG_CENTER_DVB_SUBS = 2048 #define in lib/dvb/idvb.h as dxNewFound = 64 and dxIsDedicated3D = 128

class BouquetSelector(Screen):
Expand Down Expand Up @@ -182,10 +181,10 @@ def __init__(self, session, csel):
else:
append_when_current_valid(current, menu, (_("Mark service as dedicated 3D service"), self.addDedicated3DFlag), level=2)
if not (current_sel_path):
if eDVBDB.getInstance().getFlag(eServiceReference(current.toString())) & FLAG_HIDE_VBI:
append_when_current_valid(current, menu, (_("Uncover dashed flickering line for this service"), self.removeHideVBIFlag), level=1)
if Screens.InfoBar.InfoBar.instance.checkHideVBI(current):
append_when_current_valid(current, menu, (_("Uncover dashed flickering line for this service"), self.toggleVBI), level=1)
else:
append_when_current_valid(current, menu, (_("Cover dashed flickering line for this service"), self.addHideVBIFlag), level=1)
append_when_current_valid(current, menu, (_("Cover dashed flickering line for this service"), self.toggleVBI), level=1)
if eDVBDB.getInstance().getCachedPid(eServiceReference(current.toString()), 9) >> 16 not in (-1, eDVBDB.getInstance().getCachedPid(eServiceReference(current.toString()), 2)):
#Only show when a DVB subtitle is cached on this service
if eDVBDB.getInstance().getFlag(eServiceReference(current.toString())) & FLAG_CENTER_DVB_SUBS:
Expand Down Expand Up @@ -307,15 +306,8 @@ def removeDedicated3DFlag(self):
self.set3DMode(False)
self.close()

def addHideVBIFlag(self):
eDVBDB.getInstance().addFlag(eServiceReference(self.csel.getCurrentSelection().toString()), FLAG_HIDE_VBI)
eDVBDB.getInstance().reloadBouquets()
Screens.InfoBar.InfoBar.instance.showHideVBI()
self.close()

def removeHideVBIFlag(self):
eDVBDB.getInstance().removeFlag(eServiceReference(self.csel.getCurrentSelection().toString()), FLAG_HIDE_VBI)
eDVBDB.getInstance().reloadBouquets()
def toggleVBI(self):
Screens.InfoBar.InfoBar.instance.ToggleHideVBI(self.csel.getCurrentSelection())
Screens.InfoBar.InfoBar.instance.showHideVBI()
self.close()

Expand Down
46 changes: 28 additions & 18 deletions lib/python/Screens/InfoBarGenerics.py
Expand Up @@ -124,6 +124,12 @@ def loadResumePoints():
resumePointCache = loadResumePoints()
resumePointCacheLast = int(time())

whitelist_vbi = None
def reload_whitelist_vbi():
global whitelist_vbi
whitelist_vbi = [line.strip() for line in open('/etc/enigma2/whitelist_vbi', 'r').readlines()] if os.path.isfile('/etc/enigma2/whitelist_vbi') else []
reload_whitelist_vbi()

class InfoBarDish:
def __init__(self):
self.dishDialog = self.session.instantiateDialog(Dish)
Expand Down Expand Up @@ -228,7 +234,6 @@ class InfoBarShowHide(InfoBarScreenSaver):
STATE_HIDING = 1
STATE_SHOWING = 2
STATE_SHOWN = 3
FLAG_HIDE_VBI = 512
FLAG_CENTER_DVB_SUBS = 2048

def __init__(self):
Expand Down Expand Up @@ -266,6 +271,10 @@ def __init__(self):
self.secondInfoBarScreenSimple.show()
self.actualSecondInfoBarScreen = config.usage.show_simple_second_infobar.value and self.secondInfoBarScreenSimple.skinAttributes and self.secondInfoBarScreenSimple or self.secondInfoBarScreen

from Screens.InfoBar import InfoBar
InfoBarInstance = InfoBar.instance
if InfoBarInstance:
InfoBarInstance.hideVBILineScreen.hide()
self.hideVBILineScreen = self.session.instantiateDialog(HideVBILine)
self.hideVBILineScreen.show()

Expand Down Expand Up @@ -404,38 +413,38 @@ def unlockShow(self):
if self.execing:
self.startHideTimer()

def checkHideVBI(self):
service = self.session.nav.getCurrentlyPlayingServiceReference()
def checkHideVBI(self, service = None):
service = service or self.session.nav.getCurrentlyPlayingServiceReference()
servicepath = service and service.getPath()
if servicepath:
if servicepath.startswith("/"):
if service.toString().startswith("1:"):
info = eServiceCenter.getInstance().info(service)
service = info and info.getInfoString(service, iServiceInformation.sServiceref)
return service and eDVBDB.getInstance().getFlag(eServiceReference(service)) & self.FLAG_HIDE_VBI and True
service = service and eServiceReference(service)
if service:
print service, service and service.toString()
return service and ":".join(service.toString().split(":")[:11]) in whitelist_vbi
else:
return ".hidvbi." in servicepath.lower()
elif "://" in servicepath:
return False
service = self.session.nav.getCurrentService()
info = service and service.info()
return info and info.getInfo(iServiceInformation.sHideVBI)
return ".hidevbi." in servicepath.lower()
return service and service.toString() in whitelist_vbi

def showHideVBI(self):
if self.checkHideVBI():
self.hideVBILineScreen.show()
else:
self.hideVBILineScreen.hide()

def ToggleHideVBI(self):
service = self.session.nav.getCurrentlyPlayingServiceReference()
servicepath = service and service.getPath()
if not servicepath:
if eDVBDB.getInstance().getFlag(service) & self.FLAG_HIDE_VBI:
eDVBDB.getInstance().removeFlag(service, self.FLAG_HIDE_VBI)
def ToggleHideVBI(self, service = None):
service = service or self.session.nav.getCurrentlyPlayingServiceReference()
if service:
service = service.toString()
global whitelist_vbi
if service in whitelist_vbi:
whitelist_vbi.remove(service)
else:
eDVBDB.getInstance().addFlag(service, self.FLAG_HIDE_VBI)
eDVBDB.getInstance().reloadBouquets()
whitelist_vbi.append(service)
open('/etc/enigma2/whitelist_vbi', 'w').write('\n'.join(whitelist_vbi))
self.showHideVBI()

class BufferIndicator(Screen):
Expand Down Expand Up @@ -2973,6 +2982,7 @@ def checkNotifications(self):
eDVBDB.getInstance().reloadBouquets()
eDVBDB.getInstance().reloadServicelist()
refreshServiceList()
reload_whitelist_vbi()
if "epg" in config.usage.remote_fallback_import.value:
eEPGCache.getInstance().load()
if not(n[4].endswith("NOK") and config.usage.remote_fallback_nok.value or config.usage.remote_fallback_ok.value):
Expand Down

0 comments on commit 3add870

Please sign in to comment.