comment out non correct working code,
[enigma2.git] / Navigation.py
1 from enigma import *
2 import RecordTimer
3
4 import NavigationInstance
5 import ServiceReference
6
7 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
8 class Navigation:
9         def __init__(self):
10                 if NavigationInstance.instance is not None:
11                         raise NavigationInstance.instance
12                 
13                 NavigationInstance.instance = self
14                 self.ServiceHandler = eServiceCenter.getInstance()
15
16                 import Navigation as Nav
17                 Nav.navcore = self
18                 
19                 self.pnav = pNavigation()
20                 self.pnav.m_event.get().append(self.callEvent)
21                 self.event = [ ]
22                 self.currentlyPlayingService = None
23                 
24                 self.RecordTimer = RecordTimer.RecordTimer()
25
26         def callEvent(self, i):
27                 for x in self.event:
28                         x(i)
29         
30         def playService(self, ref):
31                 self.currentlyPlayingServiceReference = None
32                 if not self.pnav.playService(ref):
33                         self.currentlyPlayingServiceReference = ref
34                         return 0
35                 return 1
36         
37         def getCurrentlyPlayingServiceReference(self):
38                 return self.currentlyPlayingServiceReference
39         
40         def recordService(self, ref):
41                 print "recording service: %s" % (str(ref))
42                 if isinstance(ref, ServiceReference.ServiceReference):
43                         ref = ref.ref
44                 service = self.pnav.recordService(ref)
45                 
46                 if service is None:
47                         print "record returned non-zero"
48                         return None
49                 else:
50                         return service
51         
52         def enqueueService(self, ref):
53                 return self.pnav.enqueueService(ref)
54         
55         def getCurrentService(self):
56                 service = self.pnav.getCurrentService()
57                 
58                 if service is None:
59                         return None
60                 
61                 return service
62         
63         def getPlaylist(self):
64                 playlist = ePlaylistPtr()
65                 if self.pnav.getPlaylist(playlist):
66                         return None
67                 return playlist
68         
69         def pause(self, p):
70                 return self.pnav.pause(p)
71         
72         def recordWithTimer(self, begin, end, ref, epg, description):
73                 if isinstance(ref, eServiceReference):
74                         ref = ServiceReference.ServiceReference(ref)
75                 entry = RecordTimer.RecordTimerEntry(begin, end, ref, epg, description)
76                 self.RecordTimer.record(entry)
77                 return entry
78         
79         def shutdown(self):
80                 self.RecordTimer.shutdown()