7 import win32serviceutil
11 class PyTivoService(win32serviceutil
.ServiceFramework
):
13 _svc_display_name_
= 'pyTivo'
15 def __init__(self
, args
):
16 win32serviceutil
.ServiceFramework
.__init
__(self
, args
)
17 self
.stop_event
= win32event
.CreateEvent(None, 0, 0, None)
20 httpd
= pyTivo
.setup(True)
24 (rx
, tx
, er
) = select
.select((httpd
,), (), (), 5)
27 rc
= win32event
.WaitForSingleObject(self
.stop_event
, 5)
28 if rc
== win32event
.WAIT_OBJECT_0
or httpd
.stop
:
35 p
= os
.path
.dirname(__file__
)
37 f
= open(os
.path
.join(p
, 'log.txt'), 'w')
41 while self
.mainloop():
45 win32event
.SetEvent(self
.stop_event
)
47 if __name__
== '__main__':
48 win32serviceutil
.HandleCommandLine(PyTivoService
)