def isServicePlayable(self, ref, callback, session=None): self.session = session if self.isProtected(ref): if self.sessionPinCached: return True self.callback = callback service = ref.toCompareString() title = 'FROM BOUQUET "userbouquet.' in service and _( "this bouquet is protected by a parental control pin") or _( "this service is protected by a parental control pin") if session: Notifications.RemovePopup("Parental control") if self.PinDlg: self.PinDlg.close() self.PinDlg = session.openWithCallback( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"), simple=False) else: Notifications.AddNotificationParentalControl( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control")) return False else: return True
def isServicePlayable(self, ref, callback, session=None): self.session = session if not config.ParentalControl.servicepinactive.value: return True #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.storeServicePin != config.ParentalControl.storeservicepin.value: self.getConfigValues() service = ref.toCompareString() info = eServiceCenter.getInstance().info(ref) age = 0 if service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/"): refstr = info and info.getInfoString(ref, iServiceInformation.sServiceref) service = refstr and eServiceReference(refstr).toCompareString() elif int(config.ParentalControl.age.value): event = info and info.getEvent(ref) rating = event and event.getParentalData() age = rating and rating.getRating() age = age and age <= 15 and age + 3 or 0 if (age and age >= int(config.ParentalControl.age.value)) or service and self.blacklist.has_key(service): #Check if the session pin is cached if self.sessionPinCached: return True self.callback = callback title = 'FROM BOUQUET "userbouquet.' in service and _("this bouquet is protected by a parental control pin") or _("this service is protected by a parental control pin") if session: Notifications.RemovePopup("Parental control") if self.PinDlg: self.PinDlg.close() self.PinDlg = session.openWithCallback(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"), simple=False) else: Notifications.AddNotificationParentalControl(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control")) return False else: return True
def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value: self.getConfigValues() service = ref.toCompareString() if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or ( config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): #Check if the session pin is cached if self.sessionPinCached: return True self.callback = callback #Someone started to implement different levels of protection. Seems they were never completed #I did not throw out this code, although it is of no use at the moment levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] pinList = self.getPinList()[:levelNeeded + 1] Notifications.AddNotificationParentalControl( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=pinList, service=ServiceReference(ref).getServiceName(), title=_("this service is protected by a parental control pin"), windowTitle=_("Parental control")) return False else: return True
def isServicePlayable(self, ref, callback, session=None): self.session = session if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value: self.getConfigValues() service = ref.toCompareString() info = eServiceCenter.getInstance().info(ref) age = 0 if service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/"): refstr = info and info.getInfoString( ref, iServiceInformation.sServiceref) service = refstr and eServiceReference(refstr).toCompareString() else: event = info and info.getEvent(ref) rating = event and event.getParentalData() age = rating and rating.getRating() + 3 or 0 if (age and age >= int(config.ParentalControl.age.value)) or service and ( (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service))): #Check if the session pin is cached if self.sessionPinCached == True: return True self.callback = callback #Someone started to implement different levels of protection. Seems they were never completed #I did not throw out this code, although it is of no use at the moment levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] pinList = self.getPinList()[:levelNeeded + 1] title = 'FROM BOUQUET "userbouquet.' in service and _( "this bouquet is protected by a parental control pin") or _( "this service is protected by a parental control pin") if session: Notifications.RemovePopup("Parental control") if self.PinDlg: self.PinDlg.close() self.PinDlg = session.openWithCallback( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=pinList, service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"), simple=False) else: Notifications.AddNotificationParentalControl( boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=pinList, service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control")) return False else: return True