re-add web plugin
authorFelix Domke <tmbinc@elitedvb.net>
Sun, 19 Feb 2006 22:36:17 +0000 (22:36 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sun, 19 Feb 2006 22:36:17 +0000 (22:36 +0000)
lib/python/Plugins/web/plugin.py

index e4c099bb5a91abaf0a06ab05008fe90d4e4e792d..1c40293afa1889c778112fe216f8e9a2e1c8eb9c 100644 (file)
@@ -1,13 +1,19 @@
 from twisted.internet import reactor
 from twisted.web2 import server, http, static
+from Plugins.Plugin import PluginDescriptor
 
-# this is currently not working
 def startWebserver():
-       print "Web startup"
        toplevel = static.File("/hdd")
        site = server.Site(toplevel)
        
        reactor.listenTCP(80, http.HTTPFactory(site))
 
+def autostart(reason):
+       if reason == 0:
+               try:
+                       startWebserver()
+               except ImportError:
+                       print "twisted not available, not starting web services"
+
 def Plugins():
-    return [ ]
+       return PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart)