pyTivo
[pyTivo/krkeegan.git] / pyTivo.py
blob17c5b10a994871ceee50e7531dc6a35210d81402
1 import beacon, httpserver, ConfigParser, os, sys
3 config = ConfigParser.ConfigParser()
4 p = os.path.dirname(__file__)
5 config.read(os.path.join(p, 'pyTivo.conf'))
7 port = config.get('Server', 'Port')
9 httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler)
11 for section in config.sections():
12 if not section == 'Server':
13 httpd.add_container(section, config.get(section, 'type'), config.get(section, 'path'))
15 b = beacon.Beacon()
16 b.add_service('TiVoMediaServer:' + str(port) + '/http')
17 b.start()
19 try:
20 httpd.serve_forever()
21 except KeyboardInterrupt:
22 b.stop()