From d29dad2c2d56f1664fd7bedf08b5e45ceb85d47c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 10 Oct 2006 13:46:16 +0000 Subject: [PATCH] use service compare strings instead of eServiceReferences in parental control --- Navigation.py | 2 +- lib/python/Components/ParentalControl.py | 25 ++++++++++++------------ lib/python/Screens/ChannelSelection.py | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Navigation.py b/Navigation.py index 9ba0afc5..f8c84173 100644 --- a/Navigation.py +++ b/Navigation.py @@ -41,7 +41,7 @@ class Navigation: self.stopService() return 0 - if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)): + if not checkParentalControl or parentalControl.isServicePlayable(ref.toCompareString(), boundFunction(self.playService, checkParentalControl = False)): if self.pnav and not self.pnav.playService(ref): self.currentlyPlayingServiceReference = ref return 0 diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index f8a6dff2..97e9fad5 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -37,26 +37,25 @@ class ParentalControl: self.tries = 3 def addWhitelistService(self, service): - self.whitelist.append(service.toCompareString()) + self.whitelist.append(service) def addBlacklistService(self, service): - self.blacklist.append(service.toCompareString()) + self.blacklist.append(service) def setServiceLevel(self, service, level): - self.serviceLevel[service.toCompareString()] = level + self.serviceLevel[service] = level def deleteWhitelistService(self, service): - self.whitelist.remove(service.toCompareString()) - if self.serviceLevel.has_key(service.toCompareString()): - self.serviceLevel.remove(service.toCompareString()) + self.whitelist.remove(service) + if self.serviceLevel.has_key(service): + self.serviceLevel.remove(service) def deleteBlacklistService(self, service): - self.blacklist.remove(service.toCompareString()) - if self.serviceLevel.has_key(service.toCompareString()): - self.serviceLevel.remove(service.toCompareString()) + self.blacklist.remove(service) + if self.serviceLevel.has_key(service): + self.serviceLevel.remove(service) - def isServicePlayable(self, serviceref, callback): - service = serviceref.toCompareString() + def isServicePlayable(self, service, callback): if not config.ParentalControl.configured.value: return True print "whitelist:", self.whitelist @@ -80,10 +79,10 @@ class ParentalControl: print "protect" print "config.ParentalControl.type.value:", config.ParentalControl.type.value if config.ParentalControl.type.value == "whitelist": - if service.toCompareString() in self.whitelist: + if service in self.whitelist: self.deleteWhitelistService(service) else: # blacklist - if service.toCompareString() not in self.blacklist: + if service not in self.blacklist: self.addBlacklistService(service) print "whitelist:", self.whitelist print "blacklist:", self.blacklist diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 58c57f41..54c48293 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -139,11 +139,11 @@ class ChannelContextMenu(Screen): self.close() def addParentalProtection(self, service): - parentalControl.protectService(service) + parentalControl.protectService(service.toCompareString()) self.close() def removeParentalProtection(self, service): - self.session.openWithCallback(boundFunction(self.pinEntered, service), PinInput, pinList = [config.ParentalControl.servicepin[0].value], title = _("Enter the service pin"), windowTitle = _("Change pin code")) + self.session.openWithCallback(boundFunction(self.pinEntered, service.toCompareString()), PinInput, pinList = [config.ParentalControl.servicepin[0].value], title = _("Enter the service pin"), windowTitle = _("Change pin code")) def pinEntered(self, service, result): if result[0]: -- 2.30.2