1c40293afa1889c778112fe216f8e9a2e1c8eb9c
[openblackhole/openblackhole-enigma2.git] / lib / python / Plugins / web / plugin.py
1 from twisted.internet import reactor
2 from twisted.web2 import server, http, static
3 from Plugins.Plugin import PluginDescriptor
4
5 def startWebserver():
6         toplevel = static.File("/hdd")
7         site = server.Site(toplevel)
8         
9         reactor.listenTCP(80, http.HTTPFactory(site))
10
11 def autostart(reason):
12         if reason == 0:
13                 try:
14                         startWebserver()
15                 except ImportError:
16                         print "twisted not available, not starting web services"
17
18 def Plugins():
19         return PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart)