UPnP notifications
UPnP will notify you through window status bar.
This commit is contained in:
parent
4d03b7e98e
commit
2ab4c3d85c
|
@ -8,6 +8,7 @@ import threading
|
||||||
import time
|
import time
|
||||||
from helper_threading import *
|
from helper_threading import *
|
||||||
import shared
|
import shared
|
||||||
|
import tr
|
||||||
|
|
||||||
def createRequestXML(service, action, arguments=[]):
|
def createRequestXML(service, action, arguments=[]):
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
|
@ -204,6 +205,7 @@ class uPnPThread(threading.Thread, StoppableThread):
|
||||||
logger.debug("Found UPnP router at %s", ip)
|
logger.debug("Found UPnP router at %s", ip)
|
||||||
self.routers.append(newRouter)
|
self.routers.append(newRouter)
|
||||||
self.createPortMapping(newRouter)
|
self.createPortMapping(newRouter)
|
||||||
|
shared.UISignalQueue.put(('updateStatusBar', tr.translateText("MainWindow",'UPnP port mapping established')))
|
||||||
break
|
break
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
pass
|
pass
|
||||||
|
@ -214,10 +216,14 @@ class uPnPThread(threading.Thread, StoppableThread):
|
||||||
self.createPortMapping(router)
|
self.createPortMapping(router)
|
||||||
self.sock.shutdown(socket.SHUT.RDWR)
|
self.sock.shutdown(socket.SHUT.RDWR)
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
|
deleted = False
|
||||||
for router in self.routers:
|
for router in self.routers:
|
||||||
if router.extPort is not None:
|
if router.extPort is not None:
|
||||||
|
deleted = True
|
||||||
self.deletePortMapping(router)
|
self.deletePortMapping(router)
|
||||||
shared.extPort = None
|
shared.extPort = None
|
||||||
|
if deleted:
|
||||||
|
shared.UISignalQueue.put(('updateStatusBar', tr.translateText("MainWindow",'UPnP port mapping removed')))
|
||||||
logger.debug("UPnP thread done")
|
logger.debug("UPnP thread done")
|
||||||
|
|
||||||
def sendSearchRouter(self):
|
def sendSearchRouter(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user