Merge branch 'master' into subfolders-8.3
[pyTivo.git] / pyTivo.py
blobe41423e1a4854f578abd5a934cfffa7039b5628b
1 #!/usr/bin/env python
3 import beacon, httpserver, os, sys
4 import config
6 port = config.getPort()
8 httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler)
10 for section, settings in config.getShares():
11 httpd.add_container(section, settings)
13 b = beacon.Beacon()
14 b.add_service('TiVoMediaServer:' + str(port) + '/http')
15 b.start()
16 if 'listen' in config.getBeaconAddresses():
17 b.listen()
19 try:
20 httpd.serve_forever()
21 except KeyboardInterrupt:
22 b.stop()