if you now zap on a channel, the scripts are checking for subchannels to insert.
[enigma2-plugins.git] / webinterface / src / WebComponents / Sources / SubServices.py
1 from enigma import *
2 from Components.Sources.Source import Source
3 from enigma import eServiceReference, iServiceInformation
4
5 from ServiceReference import ServiceReference
6 import time
7
8 class SubServices( Source):
9     
10     def __init__(self, session):
11         Source.__init__(self)        
12         self.session = session
13         
14     def command(self):
15         print "SubServices was called"
16         list = []
17         
18         time.sleep(5)
19         
20         list0 = []
21         currentService = self.session.nav.getCurrentlyPlayingServiceReference()
22         if currentService is not None:
23             list0.append(currentService.toString())
24             list0.append( ServiceReference(currentService).getServiceName() )
25             list.append(list0)
26         else:
27             list0.append("N/A")
28             list0.append("N/A")
29             list.append(list0)
30
31         service = self.session.nav.getCurrentService()
32         subservices = service and service.subServices()
33         if subservices or subservices.getNumberOfSubservices() != 0:
34             n = subservices and subservices.getNumberOfSubservices()
35             for x in range(n):
36                 list1 = []
37                 sub = subservices.getSubservice(x)
38                 list1.append(sub.toString())
39                 list1.append(sub.getName())
40                 list.append(list1)
41         
42         print "SubServices is returning list ",list
43         return list
44         
45     list = property(command)
46     lut = {"ServiceReference": 0
47            ,"Name": 1
48            }
49