10 from plugin
import GetPlugin
12 def exceptionLogger(type, value
, tb
):
13 sys
.excepthook
= sys
.__excepthook
__
14 logging
.getLogger('pyTivo').exception('Exception in pyTivo')
17 sys
.excepthook
= exceptionLogger
19 port
= config
.getPort()
21 httpd
= httpserver
.TivoHTTPServer(('', int(port
)), httpserver
.TivoHTTPHandler
)
23 logger
= logging
.getLogger('pyTivo')
25 for section
, settings
in config
.getShares():
26 httpd
.add_container(section
, settings
)
27 # Precaching of files: does a recursive list of base path
28 if settings
.get('precache', 'False').lower() == 'true':
29 plugin
= GetPlugin(settings
.get('type'))
30 if hasattr(plugin
, 'pre_cache'):
31 logger
.info('Pre-caching the ' + section
+ ' share.')
32 pre_cache_filter
= getattr(plugin
, 'pre_cache')
34 def build_recursive_list(path
):
36 for f
in os
.listdir(path
):
37 f
= os
.path
.join(path
, f
)
39 build_recursive_list(f
)
45 build_recursive_list(settings
.get('path'))
48 b
.add_service('TiVoMediaServer:%s/http' % port
)
50 if 'listen' in config
.getBeaconAddresses():
53 logger
.info('pyTivo is ready.')
58 except KeyboardInterrupt: