4 logging
.basicConfig(level
=logging
.DEBUG
)
6 import beacon
, httpserver
, os
, sys
8 from plugin
import GetPlugin
10 port
= config
.getPort()
12 httpd
= httpserver
.TivoHTTPServer(('', int(port
)), httpserver
.TivoHTTPHandler
)
14 for section
, settings
in config
.getShares():
15 httpd
.add_container(section
, settings
)
16 # Precaching of files: does a recursive list of base path
17 if settings
.get('precache', 'False').lower() == 'true':
18 plugin
= GetPlugin(settings
.get('type'))
19 if hasattr(plugin
, 'pre_cache'):
20 print 'Pre-caching the', section
, 'share.'
21 pre_cache_filter
= getattr(plugin
, 'pre_cache')
23 def build_recursive_list(path
):
25 for f
in os
.listdir(path
):
26 f
= os
.path
.join(path
, f
)
28 build_recursive_list(f
)
34 build_recursive_list(settings
.get('path'))
37 b
.add_service('TiVoMediaServer:' + str(port
) + '/http')
39 if 'listen' in config
.getBeaconAddresses():
42 logging
.getLogger('pyTivo').info('pyTivo is ready.')
46 except KeyboardInterrupt: