7fce37897a5e0c488001750a5e14c7a102690545
[enigma2.git] / lib / python / Plugins / web / plugin.py
1
2 def startWebserver():
3         from twisted.internet import reactor
4         from twisted.web2 import server, http, static
5         from Plugins.Plugin import PluginDescriptor
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)