4.2.7r1
[enigma2.git] / usr / lib / enigma2 / python / Plugins / SystemPlugins / UPnP / earlyplugin.py
1 from Components.ResourceManager import resourcemanager
2 from UPnPCore import ManagedControlPoint
3
4 from enigma import eNetworkManager
5
6 def EarlyPlugins(**kwargs):
7         cp = ManagedControlPoint()
8         resourcemanager.addResource("UPnPControlPoint", cp)
9         if eNetworkManager.getInstance().online():
10                 cp.start()
11
12 def onOnlineChanged(isOnline):
13         cp = resourcemanager.getResource("UPnPControlPoint")
14         if not cp:
15                 return
16         if isOnline:
17                 cp.start()
18         else:
19                 cp.shutdown()
20
21 _upnpOnlineChangedConn = eNetworkManager.getInstance().onlineChanged.connect(onOnlineChanged)