import cleanup
[enigma2-plugins.git] / webinterface / src / WebComponents / Sources / ParentControl.py
1 from Components.Sources.Source import Source
2 from Components.ParentalControl import parentalControl
3 from Components.config import config
4 from ServiceReference import ServiceReference
5
6 class ParentControl( Source):
7     
8     def __init__(self, session):
9         Source.__init__(self)        
10         self.session = session
11         
12     def command(self):
13         print "ParentControl was called"
14         list = []
15         
16         if config.ParentalControl.configured.value:
17             parentalControl.open()
18             servicelist = None
19             if config.ParentalControl.type.value == "whitelist":
20                 servicelist = parentalControl.whitelist
21             else:
22                 servicelist = parentalControl.blacklist
23             
24             for service_ref in servicelist:
25                 list.append( [str(service_ref),ServiceReference(service_ref).getServiceName()] )
26         
27         print "list",list
28         return list
29         
30     list = property(command)
31     lut = {"ServiceReference": 0
32            ,"ServiceName":1
33            }
34