def isServiceProtected(self, service): if not config.ParentalControl.configured.value \ or not config.ParentalControl.servicepinactive.value: print("[EPGRefresh] DEBUG: ParentalControl not configured") return False print("[EPGRefresh] DEBUG: ParentalControl ProtectionLevel:" + str(parentalControl.getProtectionLevel(str(service)))) return parentalControl.getProtectionLevel(str(service)) != -1
def isServiceProtected(self, service): if not service: return True if not config.ParentalControl.servicepinactive.value: return False refstr = ':'.join(str(service).split(':')[:11]) return parentalControl.getProtectionLevel(refstr) != -1
def ChannelSelection_zap(self, *args, **kwargs): if self.enable_pipzap and self.dopipzap: if not self.session.pipshown: self.session.pip = self.session.instantiateDialog(PictureInPicture) self.session.pip.show() self.session.pipshown = True self.revertMode = None ref = self.session.pip.getCurrentService() nref = self.getCurrentSelection() if ref is None or ref != nref: if not config.ParentalControl.configured.value or parentalControl.getProtectionLevel( nref.toCompareString()) == -1: if not self.session.pip.playService(nref): # XXX: Make sure we set an invalid ref self.session.pip.playService(None) else: baseMethods.ChannelSelection_zap(self, *args, **kwargs) # Yes, we might double-check this, but we need to re-select pipservice if pipzap is active # and we just wanted to zap in mainwindow once # XXX: do we really want this? this also resets the service when zapping from context menu # which is irritating if self.dopipzap: # This unfortunately won't work with subservices self.setCurrentSelection(self.session.pip.getCurrentService()) self.enable_pipzap = False
def addToHistory(instance, ref): if config.plugins.ZapHistoryConfigurator.enable_zap_history.value == "off": return if config.ParentalControl.servicepinactive.value and config.plugins.ZapHistoryConfigurator.enable_zap_history.value == "parental_lock": if parentalControl.getProtectionLevel(ref.toCompareString()) != -1: return if instance.servicePath is not None: tmp = instance.servicePath[:] tmp.append(ref) try: del instance.history[instance.history_pos + 1:] except Exception, e: pass if config.plugins.ZapHistoryConfigurator.e1_like_history.value and tmp in instance.history: instance.history.remove(tmp) instance.history.append(tmp) hlen = len(instance.history) if hlen > config.plugins.ZapHistoryConfigurator.maxEntries_zap_history.value: del instance.history[0] hlen -= 1 instance.history_pos = hlen - 1 if config.plugins.ZapHistoryConfigurator.e1_like_history.value: # TODO: optimize this if instance.history == instance.history_tv: config.plugins.ZapHistoryConfigurator.history_tv.value = [ [y.toString() for y in x] for x in instance.history ] else: config.plugins.ZapHistoryConfigurator.history_radio.value = [ [y.toString() for y in x] for x in instance.history ] config.plugins.ZapHistoryConfigurator.save()
def ChannelSelection_zap(self, *args, **kwargs): if self.enable_pipzap and self.dopipzap: if not self.session.pipshown: self.session.pip = self.session.instantiateDialog(PictureInPicture) self.session.pip.show() self.session.pipshown = True self.revertMode=None ref = self.session.pip.getCurrentService() nref = self.getCurrentSelection() if ref is None or ref != nref: if not config.ParentalControl.configured.value or parentalControl.getProtectionLevel(nref.toCompareString()) == -1: if not self.session.pip.playService(nref): # XXX: Make sure we set an invalid ref self.session.pip.playService(None) else: baseMethods.ChannelSelection_zap(self, *args, **kwargs) # Yes, we might double-check this, but we need to re-select pipservice if pipzap is active # and we just wanted to zap in mainwindow once # XXX: do we really want this? this also resets the service when zapping from context menu # which is irritating if self.dopipzap: # This unfortunately won't work with subservices self.setCurrentSelection(self.session.pip.getCurrentService()) self.enable_pipzap = False
def buildList(self): from Components.ParentalControl import parentalControl list = [] index = len(self.servicelist.history) - 1 for x in self.servicelist.history: ref = x[len(x) - 1] info = self.serviceHandler.info(ref) if info: name = info.getName(ref).replace('\xc2\x86', '').replace('\xc2\x87', '') event = info.getEvent(ref) if event is not None: eventName = event.getEventName() if eventName is None: eventName = '' else: eventName = '' else: name = 'N/A' eventName = '' if ref is not None: if not parentalControl.getProtectionLevel(ref.toCompareString()) == -1: pass else: list.append(ZapHistoryBrowserListEntry(index, ref, name, eventName)) index -= 1 list.reverse() self['list'].setList(list)
def addToHistory(instance, ref): if config.plugins.vZapHistory.enable.value == 'off': return else: if config.ParentalControl.servicepinactive.value and config.plugins.vZapHistory.enable.value == 'parental_lock': if parentalControl.getProtectionLevel(ref.toCompareString()) != -1: return if instance.servicePath is not None: tmp = instance.servicePath[:] tmp.append(ref) score = 0 remove = -1 for x in instance.history: if len(x) == 2: xref = x[1] else: xref = x[2] if xref == ref and remove == -1: remove = score score += 1 if remove > -1: del instance.history[remove] instance.history.append(tmp) hlen = len(instance.history) if hlen > config.plugins.vZapHistory.maxEntries.value: del instance.history[0] hlen -= 1 instance.history_pos = hlen - 1
def buildList(self): from Components.ParentalControl import parentalControl list = [] index = len(self.servicelist.history) - 1 for x in self.servicelist.history: ref = x[len(x) - 1] info = self.serviceHandler.info(ref) if info: name = info.getName(ref).replace('\xc2\x86', '').replace('\xc2\x87', '') event = info.getEvent(ref) if event is not None: eventName = event.getEventName() if eventName is None: eventName = '' else: eventName = '' else: name = 'N/A' eventName = '' if ref is not None: if not parentalControl.getProtectionLevel( ref.toCompareString()) == -1: pass else: list.append( ZapHistoryBrowserListEntry(index, ref, name, eventName)) index -= 1 list.reverse() self['list'].setList(list)
def addToHistory(instance, ref): if config.plugins.ZapHistoryConfigurator.enable_zap_history.value == "off": return if config.ParentalControl.servicepinactive.value and config.plugins.ZapHistoryConfigurator.enable_zap_history.value == "parental_lock": if parentalControl.getProtectionLevel(ref.toCompareString()) != -1: return if instance.servicePath is not None: tmp = instance.servicePath[:] tmp.append(ref) try: del instance.history[instance.history_pos+1:] except Exception, e: pass if config.plugins.ZapHistoryConfigurator.e1_like_history.value and tmp in instance.history: instance.history.remove(tmp) instance.history.append(tmp) hlen = len(instance.history) if hlen > config.plugins.ZapHistoryConfigurator.maxEntries_zap_history.value: del instance.history[0] hlen -= 1 instance.history_pos = hlen-1 if config.plugins.ZapHistoryConfigurator.e1_like_history.value: # TODO: optimize this if instance.history == instance.history_tv: config.plugins.ZapHistoryConfigurator.history_tv.value = [[y.toString() for y in x] for x in instance.history] else: config.plugins.ZapHistoryConfigurator.history_radio.value = [[y.toString() for y in x] for x in instance.history] config.plugins.ZapHistoryConfigurator.save()
def playService(self, service): if parentalControl.getProtectionLevel(service.toCompareString( )) == -1 or ( parentalControl.configInitialized and parentalControl.sessionPinCached and parentalControl.sessionPinCachedValue ): # check parentalControl, only play a protected service when Pin-Cache is activated and still valid current_service = service n_service = self.pipServiceRelation.get(service.toString(), None) # PiPServiceRelation if n_service is not None: service = eServiceReference(n_service) if service and (service.flags & eServiceReference.isGroup): ref = getBestPlayableServiceReference(service, eServiceReference()) else: ref = service if ref and ref.toString() != self.currentPiP: self.pipservice = eServiceCenter.getInstance().play(ref) if self.pipservice and not self.pipservice.setTarget(1): self.pipservice.start() self.currentPiP = current_service.toString() else: self.pipservice = None self.currentPiP = "" else: self.pipservice = None self.currentPiP = ""
def P_getservices(self, request): if "sRef" in request.args.keys(): sRef = request.args["sRef"][0] else: sRef = "" services = [] if sRef == "": sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv) serviceHandler = eServiceCenter.getInstance() serviceslist = serviceHandler.list(eServiceReference(sRef)) fulllist = serviceslist and serviceslist.getContent("RN", True) pos=0; for item in fulllist: sref = item[0].toString() hs = (int(sref.split(":")[1]) & 512) sp = (sref[:7] == '1:832:D') if not hs or sp: # 512 is hidden service on sifteam image. Doesn't affect other images pos=pos+1 service = {} service['pos'] = pos service['servicereference'] = sref service['isgroup'] = '0' service['ismarker'] = '0' service['isprotected'] = '0' if sp: service['ismarker'] = '2' service['servicename'] = '' else: service['servicename'] = item[1] if item[0].flags & eServiceReference.isGroup: service['isgroup'] = '1' if item[0].flags & eServiceReference.isMarker: service['ismarker'] = '1' # dont inc the pos for markers pos=pos-1 service['pos'] = 0 if not sp and config.ParentalControl.configured.value and config.ParentalControl.servicepinactive.value: sref = item[0].toCompareString() protection = parentalControl.getProtectionLevel(sref) if protection != -1: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist[sref]: service['isprotected'] = '1' elif "BOUQUET" in parentalControl.blacklist[sref]: service['isprotected'] = '2' else: service['isprotected'] = '3' elif config.ParentalControl.type.value == "whitelist": if not parentalControl.whitelist.has_key(sref): if item[0].flags & eServiceReference.isGroup: service['isprotected'] = '5' else: service['isprotected'] = '4' services.append(service) return { "services": services }
def P_getservices(self, request): if "sRef" in request.args.keys(): sRef = request.args["sRef"][0] else: sRef = "" services = [] if sRef == "": sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv) serviceHandler = eServiceCenter.getInstance() serviceslist = serviceHandler.list(eServiceReference(sRef)) fulllist = serviceslist and serviceslist.getContent("RN", True) pos = 0 for item in fulllist: sref = item[0].toString() hs = (int(sref.split(":")[1]) & 512) sp = (sref[:7] == '1:832:D') if not hs or sp: # 512 is hidden service on sifteam image. Doesn't affect other images pos = pos + 1 service = {} service['pos'] = pos service['servicereference'] = sref service['isgroup'] = '0' service['ismarker'] = '0' service['isprotected'] = '0' if sp: service['ismarker'] = '2' service['servicename'] = '' else: service['servicename'] = item[1] if item[0].flags & eServiceReference.isGroup: service['isgroup'] = '1' if item[0].flags & eServiceReference.isMarker: service['ismarker'] = '1' # dont inc the pos for markers pos = pos - 1 service['pos'] = 0 if not sp and config.ParentalControl.configured.value and config.ParentalControl.servicepinactive.value: sref = item[0].toCompareString() protection = parentalControl.getProtectionLevel(sref) if protection != -1: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist[sref]: service['isprotected'] = '1' elif "BOUQUET" in parentalControl.blacklist[sref]: service['isprotected'] = '2' else: service['isprotected'] = '3' elif config.ParentalControl.type.value == "whitelist": if not parentalControl.whitelist.has_key(sref): if item[0].flags & eServiceReference.isGroup: service['isprotected'] = '5' else: service['isprotected'] = '4' services.append(service) return {"services": services}
def letterChosen(self, result): if result is not None: print "result:", result self.currentLetter = result[1] self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionLevel(x[0]) != -1) for x in self.servicesList[result[1]]] self.servicelist.setList(self.list) else: parentalControl.save() self.close()
def toggleLock(self, param): if not config.ParentalControl.configured.value: return (False, _("Parent Control is not activated.")) sRef = None if "sRef" in param: if param["sRef"] is not None: sRef = param["sRef"] if sRef is None: return (False, _("No service given!")) if "setuppinactive" in config.ParentalControl.dict().keys( ) and config.ParentalControl.setuppinactive.value: password = None if "password" in param: if param["password"] is not None: password = param["password"] if password is None: return (False, _("No Parent Control Setup Pin given!")) else: if password.isdigit(): if int(password) != config.ParentalControl.setuppin.value: return (False, _("Parent Control Setup Pin is wrong!")) else: return (False, _("Parent Control Setup Pin is wrong!")) cur_ref = eServiceReference(sRef) protection = parentalControl.getProtectionLevel( cur_ref.toCompareString()) if protection: parentalControl.unProtectService(cur_ref.toCompareString()) else: parentalControl.protectService(cur_ref.toCompareString()) if cur_ref.flags & eServiceReference.mustDescent: serviceType = "Bouquet" else: serviceType = "Service" if protection: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist.has_key(sref): protectionText = _( "Service %s is locked.") % self.getName(cur_ref) elif "BOUQUET" in parentalControl.blacklist.has_key(sref): protectionText = _( "Bouquet %s is locked.") % self.getName(cur_ref) else: protectionText = _("%s %s is locked.") % ( serviceType, self.getName(cur_ref)) else: if hasattr(ParentalControl, "whitelist" ) and parentalControl.whitelist.has_key(sref): if "SERVICE" in parentalControl.whitelist.has_key(sref): protectionText = _( "Service %s is unlocked.") % self.getName(cur_ref) elif "BOUQUET" in parentalControl.whitelist.has_key(sref): protectionText = _( "Bouquet %s is unlocked.") % self.getName(cur_ref) return (True, protectionText)
def ParentalControl(self): if not fileExists('/proc/stb/lcd/symbol_parent_rating'): return service = self.session.nav.getCurrentlyPlayingServiceReference() if service: if parentalControl.getProtectionLevel(service.toCompareString()) == -1: open('/proc/stb/lcd/symbol_parent_rating', 'w').write('0') else: open('/proc/stb/lcd/symbol_parent_rating', 'w').write('1') else: open('/proc/stb/lcd/symbol_parent_rating', 'w').write('0')
def ParentalControl(self): if not fileExists("/proc/stb/lcd/symbol_parent_rating"): return service = self.session.nav.getCurrentlyPlayingServiceReference() print("[VfdSymbols] Write to /proc/stb/lcd/symbol_parent_rating") if service: if parentalControl.getProtectionLevel(service.toCompareString()) == -1: open("/proc/stb/lcd/symbol_parent_rating", "w").write("0") else: open("/proc/stb/lcd/symbol_parent_rating", "w").write("1") else: open("/proc/stb/lcd/symbol_parent_rating", "w").write("0")
def letterChosen(self, result): if result is not None: print "result:", result self.currentLetter = result[1] self.list = [ ParentalControlEntryComponent( x[0], x[1], parentalControl.getProtectionLevel(x[0]) != -1) for x in self.servicesList[result[1]] ] self.servicelist.setList(self.list) else: parentalControl.save() self.close()
def toggleLock(self, param): if not config.ParentalControl.configured.value: return (False, "Parent Control is not activated.") sRef = None if "sRef" in param: if param["sRef"] is not None: sRef = param["sRef"] if sRef is None: return (False, "No service given!") if "setuppinactive" in config.ParentalControl.dict().keys() and config.ParentalControl.setuppinactive.value: password = None if "password" in param: if param["password"] is not None: password = param["password"] if password is None: return (False, "No Parent Control Setup Pin given!") else: if password.isdigit(): if int(password) != config.ParentalControl.setuppin.value: return (False, "Parent Control Setup Pin is wrong!") else: return (False, "Parent Control Setup Pin is wrong!") cur_ref = eServiceReference(sRef) protection = parentalControl.getProtectionLevel(cur_ref.toCompareString()) if protection: parentalControl.unProtectService(cur_ref.toCompareString()) else: parentalControl.protectService(cur_ref.toCompareString()) if cur_ref.flags & eServiceReference.mustDescent: serviceType = "Bouquet" else: serviceType = "Service" if protection: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist.has_key(sref): protectionText = "Service %s is locked." % self.getName(cur_ref) elif "BOUQUET" in parentalControl.blacklist.has_key(sref): protectionText = "Bouquet %s is locked." % self.getName(cur_ref) else: protectionText = "%s %s is locked." % (serviceType, self.getName(cur_ref)) else: if hasattr(ParentalControl, "whitelist") and parentalControl.whitelist.has_key(sref): if "SERVICE" in parentalControl.whitelist.has_key(sref): protectionText = "Service %s is unlocked." % self.getName(cur_ref) elif "BOUQUET" in parentalControl.whitelist.has_key(sref): protectionText = "Bouquet %s is unlocked." % self.getName(cur_ref) return (True, protectionText)
def P_getservices(self, request): if "sRef" in request.args.keys(): sRef = request.args["sRef"][0] else: sRef = "" services = [] if sRef == "": sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv) serviceHandler = eServiceCenter.getInstance() serviceslist = serviceHandler.list(eServiceReference(sRef)) fulllist = serviceslist and serviceslist.getContent("RN", True) for item in fulllist: sref = item[0].toString() if not int(sref.split(":")[1]) & 512: # 512 is hidden service on sifteam image. Doesn't affect other images service = {} service['servicereference'] = sref service['servicename'] = item[1] service['isgroup'] = '0' if item[0].flags & eServiceReference.isGroup: service['isgroup'] = '1' service['ismarker'] = '0' if item[0].flags & eServiceReference.isMarker: service['ismarker'] = '1' service['isprotected'] = '0' if config.ParentalControl.configured.value: sref = item[0].toCompareString() protection = parentalControl.getProtectionLevel(sref) if protection: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist.has_key(sref): service['isprotected'] = '1' elif "BOUQUET" in parentalControl.blacklist.has_key(sref): service['isprotected'] = '2' else: service['isprotected'] = '3' else: if hasattr(ParentalControl, "whitelist") and parentalControl.whitelist.has_key(sref): if "SERVICE" in parentalControl.whitelist.has_key(sref): service['isprotected'] = '4' elif "BOUQUET" in parentalControl.whitelist.has_key(sref): service['isprotected'] = '5' services.append(service) return { "services": services }
def ParentalControl(self): if not fileExists("/proc/stb/lcd/symbol_parent_rating"): return service = self.session.nav.getCurrentlyPlayingServiceReference() if service: if parentalControl.getProtectionLevel(service.toCompareString()) == -1: f = open("/proc/stb/lcd/symbol_parent_rating", "w") f.write("0") f.close() else: f = open("/proc/stb/lcd/symbol_parent_rating", "w") f.write("1") f.close() else: f = open("/proc/stb/lcd/symbol_parent_rating", "w") f.write("0") f.close()
def getProtection(sref): isProtected = "0" if config.ParentalControl.configured.value: protection = parentalControl.getProtectionLevel(sref) if protection: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist.has_key(sref): service['isprotected'] = '1' elif "BOUQUET" in parentalControl.blacklist.has_key(sref): service['isprotected'] = '2' else: service['isprotected'] = '3' else: if hasattr(ParentalControl, "whitelist") and parentalControl.whitelist.has_key(sref): if "SERVICE" in parentalControl.whitelist.has_key(sref): service['isprotected'] = '4' elif "BOUQUET" in parentalControl.whitelist.has_key(sref): service['isprotected'] = '5' return isProtected
def getProtection(sref): isProtected = "0" if config.ParentalControl.configured.value and config.ParentalControl.servicepinactive.value: protection = parentalControl.getProtectionLevel(sref) if protection != -1: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist[sref]: isProtected = '1' elif "BOUQUET" in parentalControl.blacklist[sref]: isProtected = '2' else: isProtected = '3' elif config.ParentalControl.type.value == "whitelist": if not parentalControl.whitelist.has_key(sref): service = eServiceReference(sref) if service.flags & eServiceReference.isGroup: isprotected = '5' else: isProtected = '4' return isProtected
def playService(self, service): if parentalControl.getProtectionLevel(service.toCompareString()) == -1 or (parentalControl.configInitialized and parentalControl.sessionPinCached and parentalControl.sessionPinCachedValue): # check parentalControl, only play a protected service when Pin-Cache is activated and still valid current_service = service n_service = self.pipServiceRelation.get(service.toString(),None) # PiPServiceRelation if n_service is not None: service = eServiceReference(n_service) if service and (service.flags & eServiceReference.isGroup): ref = getBestPlayableServiceReference(service, eServiceReference()) else: ref = service if ref and ref.toString() != self.currentPiP: self.pipservice = eServiceCenter.getInstance().play(ref) if self.pipservice and not self.pipservice.setTarget(1): self.pipservice.start() self.currentPiP = current_service.toString() else: self.pipservice = None self.currentPiP = "" else: self.pipservice = None self.currentPiP = ""
def getProtection(sref): isProtected = "0" if config.ParentalControl.configured.value: protection = parentalControl.getProtectionLevel(sref) if protection: if config.ParentalControl.type.value == "blacklist": if parentalControl.blacklist.has_key(sref): if "SERVICE" in parentalControl.blacklist.has_key(sref): service['isprotected'] = '1' elif "BOUQUET" in parentalControl.blacklist.has_key(sref): service['isprotected'] = '2' else: service['isprotected'] = '3' else: if hasattr(ParentalControl, "whitelist" ) and parentalControl.whitelist.has_key(sref): if "SERVICE" in parentalControl.whitelist.has_key(sref): service['isprotected'] = '4' elif "BOUQUET" in parentalControl.whitelist.has_key(sref): service['isprotected'] = '5' return isProtected
def __init__(self, session, csel): Screen.__init__(self, session) #raise Exception("we need a better summary screen here") self.csel = csel self.bsel = None self["actions"] = ActionMap(["OkCancelActions"], { "ok": self.okbuttonClick, "cancel": self.cancelClick }) menu = [ ] current = csel.getCurrentSelection() current_root = csel.getRoot() current_sel_path = current.getPath() current_sel_flags = current.flags inBouquetRootList = current_root and current_root.getPath().find('FROM BOUQUET "bouquets.') != -1 #FIXME HACK inBouquet = csel.getMutableList() is not None haveBouquets = config.usage.multibouquet.value if not (current_sel_path or current_sel_flags & (eServiceReference.isDirectory|eServiceReference.isMarker)): append_when_current_valid(current, menu, (_("show transponder info"), self.showServiceInformations), level = 2) if csel.bouquet_mark_edit == OFF and not csel.movemode: if not inBouquetRootList: isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory)) if isPlayable: if config.ParentalControl.configured.value: if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1: append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0) else: append_when_current_valid(current, menu, (_("remove from parental protection"), boundFunction(self.removeParentalProtection, csel.getCurrentSelection())), level = 0) if haveBouquets: append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0) else: append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0) else: if current_root.getPath().find('FROM SATELLITES') != -1: append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0) if haveBouquets: if not inBouquet and current_sel_path.find("PROVIDERS") == -1: append_when_current_valid(current, menu, (_("copy to bouquets"), self.copyCurrentToBouquetList), level = 0) if current_sel_path.find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1: append_when_current_valid(current, menu, (_("remove all new found flags"), self.removeAllNewFoundFlags), level = 0) if inBouquet: append_when_current_valid(current, menu, (_("remove entry"), self.removeCurrentService), level = 0) if current_root and current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1: append_when_current_valid(current, menu, (_("remove new found flag"), self.removeNewFoundFlag), level = 0) else: menu.append((_("add bouquet"), self.showBouquetInputBox)) append_when_current_valid(current, menu, (_("remove entry"), self.removeBouquet), level = 0) if inBouquet: # current list is editable? if csel.bouquet_mark_edit == OFF: if not csel.movemode: append_when_current_valid(current, menu, (_("enable move mode"), self.toggleMoveMode), level = 1) if not inBouquetRootList and current_root and not (current_root.flags & eServiceReference.isGroup): menu.append((_("add marker"), self.showMarkerInputBox)) if haveBouquets: append_when_current_valid(current, menu, (_("enable bouquet edit"), self.bouquetMarkStart), level = 0) else: append_when_current_valid(current, menu, (_("enable favourite edit"), self.bouquetMarkStart), level = 0) if current_sel_flags & eServiceReference.isGroup: append_when_current_valid(current, menu, (_("edit alternatives"), self.editAlternativeServices), level = 2) append_when_current_valid(current, menu, (_("show alternatives"), self.showAlternativeServices), level = 2) append_when_current_valid(current, menu, (_("remove all alternatives"), self.removeAlternativeServices), level = 2) elif not current_sel_flags & eServiceReference.isMarker: append_when_current_valid(current, menu, (_("add alternatives"), self.addAlternativeServices), level = 2) else: append_when_current_valid(current, menu, (_("disable move mode"), self.toggleMoveMode), level = 0) else: if csel.bouquet_mark_edit == EDIT_BOUQUET: if haveBouquets: append_when_current_valid(current, menu, (_("end bouquet edit"), self.bouquetMarkEnd), level = 0) append_when_current_valid(current, menu, (_("abort bouquet edit"), self.bouquetMarkAbort), level = 0) else: append_when_current_valid(current, menu, (_("end favourites edit"), self.bouquetMarkEnd), level = 0) append_when_current_valid(current, menu, (_("abort favourites edit"), self.bouquetMarkAbort), level = 0) else: append_when_current_valid(current, menu, (_("end alternatives edit"), self.bouquetMarkEnd), level = 0) append_when_current_valid(current, menu, (_("abort alternatives edit"), self.bouquetMarkAbort), level = 0) menu.append((_("back"), self.cancelClick)) self["menu"] = MenuList(menu)
def P_getservices(self, request): sRef = getUrlArg(request, "sRef", "") includePicon = (getUrlArg(request, "picon", "") == '1') services = [] CalcPos = False if sRef == "": sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % ( service_types_tv) CalcPos = True elif ' "bouquets.radio" ' in sRef: CalcPos = True elif ' "bouquets.tv" ' in sRef: CalcPos = True serviceHandler = eServiceCenter.getInstance() serviceslist = serviceHandler.list(eServiceReference(sRef)) fulllist = serviceslist and serviceslist.getContent("RN", True) pos = 0 oPos = 0 for item in fulllist: oldoPos = oPos if CalcPos: sref = item[0].toString() serviceslist = serviceHandler.list(eServiceReference(sref)) sfulllist = serviceslist and serviceslist.getContent( "RN", True) for sitem in sfulllist: sref = sitem[0].toString() hs = (int(sref.split(":")[1]) & 512) sp = (sref[:7] == '1:832:D') if not hs or sp: # 512 is hidden service on sifteam image. Doesn't affect other images oPos = oPos + 1 if not sp and sitem[ 0].flags & eServiceReference.isMarker: oPos = oPos - 1 sref = item[0].toString() hs = (int(sref.split(":")[1]) & 512) sp = (sref[:7] == '1:832:D') if not hs or sp: # 512 is hidden service on sifteam image. Doesn't affect other images pos = pos + 1 service = {} if CalcPos: service['startpos'] = oldoPos service['pos'] = pos service['servicereference'] = sref service['isgroup'] = '0' service['ismarker'] = '0' service['isprotected'] = '0' if includePicon: try: service['picon'] = getPicon(sref) except: service['picon'] = '' if sp: service['ismarker'] = '2' service['servicename'] = '' else: service['servicename'] = item[1] if item[0].flags & eServiceReference.isGroup: gservices = [] service['isgroup'] = '1' # get members of group gserviceslist = serviceHandler.list( eServiceReference(sref)) gfulllist = gserviceslist and gserviceslist.getContent( "RN", True) for gitem in gfulllist: gservice = {} gservice['servicereference'] = gitem[0].toString() gservice['servicename'] = gitem[1] gservices.append(gservice) service['members'] = gservices if item[0].flags & eServiceReference.isMarker: service['ismarker'] = '1' # dont inc the pos for markers pos = pos - 1 service['pos'] = 0 if not sp and config.ParentalControl.configured.value and config.ParentalControl.servicepinactive.value: sref = item[0].toCompareString() protection = parentalControl.getProtectionLevel(sref) if protection != -1: if config.ParentalControl.type.value == "blacklist": if sref in parentalControl.blacklist: if "SERVICE" in parentalControl.blacklist[ sref]: service['isprotected'] = '1' elif "BOUQUET" in parentalControl.blacklist[ sref]: service['isprotected'] = '2' else: service['isprotected'] = '3' elif config.ParentalControl.type.value == "whitelist": if sref not in parentalControl.whitelist: if item[0].flags & eServiceReference.isGroup: service['isprotected'] = '5' else: service['isprotected'] = '4' services.append(service) return {"services": services}
def isServiceProtected(self, service): return parentalControl.getProtectionLevel(str(service)) != -1