restructure webif, add automake/autoconf
[enigma2-plugins.git] / webinterface / src / WebComponents / Sources / Timer.py
1 from enigma import *
2
3 from Source import Source
4 from ServiceReference import ServiceReference
5 from enigma import eServiceReference 
6 class Timer( Source):
7     
8     def __init__(self, session):
9         #self.func = func
10         Source.__init__(self)        
11         self.session = session
12         self.recordtimer = session.nav.RecordTimer
13         
14 #    def handleCommand(self,cmd):
15 #        self.command = cmd
16
17     
18     def command(self):
19         timerlist = []
20         for item in self.recordtimer.timer_list+self.recordtimer.processed_timers:
21             timer = []
22             timer.append(item.service_ref)
23             timer.append(item.service_ref.getServiceName())
24             timer.append(item.eit)
25             timer.append(self.convert(item.name))
26             timer.append(self.convert(item.description))
27             timer.append(item.disabled)
28             timer.append(item.begin)
29             timer.append(item.end)
30             timer.append(item.end-item.begin)
31             timer.append(item.start_prepare)
32             timer.append(item.justplay)
33             timer.append(item.afterEvent)
34             timer.append(item.log_entries)
35             try: 
36                 timer.append(item.Filename)
37             except AttributeError:
38                 timer.append("")
39             
40             timer.append(item.backoff)       
41             try:
42                 timer.append(item.next_activation)
43             except AttributeError:
44                 timer.append("")
45             timer.append(item.first_try_prepare)  
46             timer.append(item.state)  
47             timer.append(item.repeated)
48             timer.append(item.dontSave)
49             timer.append(item.cancelled)
50             timerlist.append(timer) 
51             
52         return timerlist
53     
54     def convert(self,input):
55         #this is not nice, but ",',<,> and & are controlchars in xml and must be replaced
56         return input.replace("<","&lt;").replace(">","&gt;").replace("&","&amp;").replace("\"","&quot;").replace("'","&apos;")
57         
58     list = property(command)
59     lut = {"ServiceReference": 0
60            ,"ServiceName": 1
61            ,"EIT":2
62            ,"Name":3
63            ,"Description":4
64            ,"Disabled":5
65            ,"TimeBegin":6
66            ,"TimeEnd":7
67            ,"Duration":8
68            ,"startPrepare":9
69            ,"justPlay":10
70            ,"afterEvent":11
71            ,"LogEntries":12
72            ,"Filename":13
73            ,"Backoff":14
74            ,"nextActivation":15
75            ,"firstTryPrepare":16
76            ,"State":17
77            ,"Repeated":18
78            ,"dontSave":19
79            ,"Cancled":20
80            }
81