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