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 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.getProtectionType(
         cur_ref.toCompareString())
     if protection[0]:
         parentalControl.unProtectService(cur_ref.toCompareString())
     else:
         parentalControl.protectService(cur_ref.toCompareString())
     protection = parentalControl.getProtectionType(
         cur_ref.toCompareString())
     if cur_ref.flags & eServiceReference.mustDescent:
         serviceType = "Bouquet"
     else:
         serviceType = "Service"
     protectionText = "%s %s is unlocked." % (serviceType,
                                              self.getName(cur_ref))
     if protection[0]:
         if protection[1] == IMG_BLACKSERVICE:
             protectionText = "Service %s is locked." % self.getName(
                 cur_ref)
         elif protection[1] == IMG_BLACKBOUQUET:
             #(locked -B-)
             protectionText = "Bouquet %s is locked." % self.getName(
                 cur_ref)
         elif protection[1] == "":
             # (locked)
             protectionText = "%s %s is locked." % (serviceType,
                                                    self.getName(cur_ref))
     else:
         if protection[1] == IMG_WHITESERVICE:
             #(unlocked -S-)
             protectionText = "Service %s is unlocked." % self.getName(
                 cur_ref)
         elif protection[1] == IMG_WHITEBOUQUET:
             #(unlocked -B-)
             protectionText = "Bouquet %s is unlocked." % self.getName(
                 cur_ref)
     return (True, protectionText)
예제 #2
0
	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 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.getProtectionType(cur_ref.toCompareString())
		if protection[0]:
			parentalControl.unProtectService(cur_ref.toCompareString())
		else:
			parentalControl.protectService(cur_ref.toCompareString())
		protection = parentalControl.getProtectionType(cur_ref.toCompareString())
		if cur_ref.flags & eServiceReference.mustDescent:
			serviceType = "Bouquet"
		else:
			serviceType = "Service"
		protectionText = "%s %s is unlocked." % (serviceType, self.getName(cur_ref))
		if protection[0]:
			if protection[1] == IMG_BLACKSERVICE:
				protectionText = "Service %s is locked." % self.getName(cur_ref)
			elif protection[1] == IMG_BLACKBOUQUET:
				#(locked -B-)
				protectionText = "Bouquet %s is locked." % self.getName(cur_ref)
			elif protection[1] == "":
				# (locked)
				protectionText = "%s %s is locked." % (serviceType, self.getName(cur_ref))
		else:
			if protection[1] == IMG_WHITESERVICE:
				#(unlocked -S-)
				protectionText = "Service %s is unlocked."  % self.getName(cur_ref)
			elif protection[1] == IMG_WHITEBOUQUET:
				#(unlocked -B-)
				protectionText = "Bouquet %s is unlocked."  % self.getName(cur_ref)
		return (True, protectionText)
예제 #3
0
 def selectBouquet(self):
     self.list = [
         ParentalControlEntryComponent(
             x[0], x[1], parentalControl.getProtectionType(x[0]))
         for x in self.bouquetlist
     ]
     self.bouquetslist.setList(self.list)
예제 #4
0
	def letterChosen(self, result):
		from Components.ParentalControl import parentalControl
		if result is not None:
			self.currentLetter = result[1]
			self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.servicesList[result[1]]]
			self.servicelist.setList(self.list)
		else:
			parentalControl.save()
			self.close()
예제 #5
0
	def letterChosen(self, result):
		if result is not None:
			print "result:", result
			self.currentLetter = result[1]
			#Replace getProtectionLevel by new getProtectionType
			self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.servicesList[result[1]]]
			self.servicelist.setList(self.list)
		else:
			parentalControl.save()
			self.close()
예제 #6
0
 def letterChosen(self, result):
     if result is not None:
         print "result:", result
         self.currentLetter = result[1]
         #Replace getProtectionLevel by new getProtectionType
         self.list = [
             ParentalControlEntryComponent(
                 x[0], x[1], parentalControl.getProtectionType(x[0]))
             for x in self.servicesList[result[1]]
         ]
         self.servicelist.setList(self.list)
     else:
         parentalControl.save()
         self.close()
예제 #7
0
 def toggleSelectedLock(self):
     print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
     print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex(
     )
     curSel = self.l.getCurrentSelection()
     if curSel[0][2]:
         parentalControl.unProtectService(
             self.l.getCurrentSelection()[0][0])
     else:
         parentalControl.protectService(self.l.getCurrentSelection()[0][0])
     #Instead of just negating the locked- flag, now I call the getProtectionType every time...
     self.list[
         self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(
             curSel[0][0], curSel[0][1],
             parentalControl.getProtectionType(curSel[0][0]))
     self.l.setList(self.list)
예제 #8
0
    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:
                    protection = parentalControl.getProtectionType(
                        item[0].toCompareString())
                    if protection[0]:
                        if protection[1] == IMG_BLACKSERVICE:
                            service['isprotected'] = '1'
                        elif protection[1] == IMG_BLACKBOUQUET:
                            service['isprotected'] = '2'
                        elif protection[1] == "":
                            service['isprotected'] = '3'
                    else:
                        if protection[1] == IMG_WHITESERVICE:
                            service['isprotected'] = '4'
                        elif protection[1] == IMG_WHITEBOUQUET:
                            service['isprotected'] = '5'
                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)

		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:
					protection = parentalControl.getProtectionType(item[0].toCompareString())
					if protection[0]:
						if protection[1] == IMG_BLACKSERVICE:
							service['isprotected'] = '1'
						elif protection[1] == IMG_BLACKBOUQUET:
							service['isprotected'] = '2'
						elif protection[1] == "":
							service['isprotected'] = '3'
					else:
						if protection[1] == IMG_WHITESERVICE:
							service['isprotected'] = '4'
						elif protection[1] == IMG_WHITEBOUQUET:
							service['isprotected'] = '5'
				services.append(service)
		return { "services": services }
    def getServicesAsList(self, format="RN"):
        services = self.getServiceList()
        mylist = services and services.getContent(format, True)
        list = []
        for item in mylist:
            if item[0].flags & eServiceReference.isGroup:
                isGroup = "1"
            else:
                isGroup = "0"
            if item[0].flags & eServiceReference.isMarker:
                isMarker = "1"
            else:
                isMarker = "0"
            isProtected = "0"
            if config.ParentalControl.configured.value:
                protection = parentalControl.getProtectionType(
                    item[0].toCompareString())
                if protection[0]:
                    if protection[1] == IMG_BLACKSERVICE:
                        #(locked -S-)
                        isProtected = "1"
                    elif protection[1] == IMG_BLACKBOUQUET:
                        #(locked -B-)
                        isProtected = "2"
                    elif protection[1] == "":
                        # (locked)
                        isProtected = "3"
                else:
                    if protection[1] == IMG_WHITESERVICE:
                        #(unlocked -S-)
                        isProtected = "4"
                    elif protection[1] == IMG_WHITEBOUQUET:
                        #(unlocked -B-)
                        isProtected = "5"
            isStream = "0"
            if item[0].getPath():
                isStream = "1"

            list.append((item[0].toString(), item[1], isGroup, isMarker,
                         isProtected, isStream))
        print "list", list
        return list
예제 #11
0
def getProtection(sref):
    isProtected = "0"
    if config.ParentalControl.configured.value:
        protection = parentalControl.getProtectionType(sref)
        if protection[0]:
            if protection[1] == IMG_BLACKSERVICE:
                #(locked -S-)
                isProtected = "1"
            elif protection[1] == IMG_BLACKBOUQUET:
                #(locked -B-)
                isProtected = "2"
            elif protection[1] == "":
                # (locked)
                isProtected = "3"
        else:
            if protection[1] == IMG_WHITESERVICE:
                #(unlocked -S-)
                isProtected = "4"
            elif protection[1] == IMG_WHITEBOUQUET:
                #(unlocked -B-)
                isProtected = "5"
    return isProtected
예제 #12
0
def getProtection(sref):
	isProtected = "0"
	if config.ParentalControl.configured.value:
		protection = parentalControl.getProtectionType(sref)
		if protection[0]:
			if protection[1] == IMG_BLACKSERVICE:
				#(locked -S-)
				isProtected = "1"
			elif protection[1] == IMG_BLACKBOUQUET:
				#(locked -B-)
				isProtected = "2"
			elif protection[1] == "":
				# (locked)
				isProtected = "3"
		else:
			if protection[1] == IMG_WHITESERVICE:
				#(unlocked -S-)
				isProtected = "4"
			elif protection[1] == IMG_WHITEBOUQUET:
				#(unlocked -B-)
				isProtected = "5"
	return isProtected
예제 #13
0
    def toggleSelectedLock(self):
        from Components.ParentalControl import parentalControl
        print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
        print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex(
        )
        # [iq - problem with many channels
        if self.l.getCurrentSelection(
        ) is None or self.l.getCurrentSelectionIndex() is None:
            return
# iq]
        curSel = self.l.getCurrentSelection()
        if curSel[0][2]:
            parentalControl.unProtectService(
                self.l.getCurrentSelection()[0][0])
        else:
            parentalControl.protectService(self.l.getCurrentSelection()[0][0])
        #Instead of just negating the locked- flag, now I call the getProtectionType every time...
        self.list[
            self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(
                curSel[0][0], curSel[0][1],
                parentalControl.getProtectionType(curSel[0][0]))
        self.l.setList(self.list)
예제 #14
0
	def getServicesAsList(self, format = "RN"):
		services = self.getServiceList()
		mylist = services and services.getContent(format, True)
		list = []
		for item in mylist:
			if item[0].flags & eServiceReference.isGroup:
				isGroup = "1"
			else:
				isGroup = "0"
			if item[0].flags & eServiceReference.isMarker:
				isMarker = "1"
			else:
				isMarker = "0"
			isProtected = "0"
			if config.ParentalControl.configured.value:
				protection = parentalControl.getProtectionType(item[0].toCompareString())
				if protection[0]:
					if protection[1] == IMG_BLACKSERVICE:
						#(locked -S-)
						isProtected = "1"
					elif protection[1] == IMG_BLACKBOUQUET:
						#(locked -B-)
						isProtected = "2"
					elif protection[1] == "":
						# (locked)
						isProtected = "3"
				else:
					if protection[1] == IMG_WHITESERVICE:
						#(unlocked -S-)
						isProtected = "4"
					elif protection[1] == IMG_WHITEBOUQUET:
						#(unlocked -B-)
						isProtected = "5"
					
			list.append((item[0].toString(),item[1],isGroup,isMarker,isProtected))
		return list
예제 #15
0
 def selectBouquet(self):
     self.list = [
         ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.bouquetlist
     ]
     self.bouquetslist.setList(self.list)
예제 #16
0
	def toggleSelectedLock(self):
		from Components.ParentalControl import parentalControl
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
# [iq - problem with many channels
		if self.l.getCurrentSelection() is None or self.l.getCurrentSelectionIndex() is None:
			return
# iq]
		curSel = self.l.getCurrentSelection()
		if curSel[0][2]:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])
		#Instead of just negating the locked- flag, now I call the getProtectionType every time...
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
		self.l.setList(self.list)
예제 #17
0
	def toggleSelectedLock(self):
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
		curSel = self.l.getCurrentSelection()
		if curSel[0][2]:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])	
		#Instead of just negating the locked- flag, now I call the getProtectionType every time...
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
		self.l.setList(self.list)