mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
2b70c7e906
commit
a23f69997c
1 changed files with 7 additions and 8 deletions
|
|
@ -168,18 +168,17 @@ def add_port_mapping():
|
||||||
except (NATPMPUnsupportedError, NATPMPNetworkError):
|
except (NATPMPUnsupportedError, NATPMPNetworkError):
|
||||||
import upnpy
|
import upnpy
|
||||||
from upnpy.exceptions import SOAPError
|
from upnpy.exceptions import SOAPError
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
|
|
||||||
upnp = upnpy.UPnP()
|
upnp = upnpy.UPnP()
|
||||||
devices = upnp.discover()
|
devices = upnp.discover()
|
||||||
|
|
||||||
if devices == []:
|
if devices == []:
|
||||||
babase.screenmessage(
|
babase.screenmessage(
|
||||||
"Please enable upnp service on your router", (1.00, 0.15, 0.15)
|
"Please enable upnp service on your router", (1.00, 0.15, 0.15)
|
||||||
)
|
)
|
||||||
# bui.getsound('shieldDown').play() -> RuntimeError : Sound creation failed
|
# bui.getsound('shieldDown').play() -> RuntimeError : Sound creation failed
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
local_ip = (
|
local_ip = (
|
||||||
(
|
(
|
||||||
|
|
@ -236,7 +235,6 @@ def add_port_mapping():
|
||||||
bui.getsound("shieldUp").play()
|
bui.getsound("shieldUp").play()
|
||||||
except (SOAPError, HTTPError, UnicodeDecodeError):
|
except (SOAPError, HTTPError, UnicodeDecodeError):
|
||||||
babase.screenmessage('You will need to manualy add the port at the router :(')
|
babase.screenmessage('You will need to manualy add the port at the router :(')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
|
|
@ -259,16 +257,17 @@ def delete_port_mapping():
|
||||||
|
|
||||||
upnp = upnpy.UPnP()
|
upnp = upnpy.UPnP()
|
||||||
devices = upnp.discover()
|
devices = upnp.discover()
|
||||||
|
|
||||||
if devices == []:
|
if devices == []:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for upnp_dev in devices:
|
for upnp_dev in devices:
|
||||||
for service in upnp_dev.services:
|
for service in upnp_dev.services:
|
||||||
if service in WAN_SERVICE_NAMES:
|
if service in WAN_SERVICE_NAMES:
|
||||||
service = upnp_dev[service]
|
service = upnp_dev[service]
|
||||||
service.DeletePortMapping(NewRemoteHost="", NewExternalPort=BS_PORT, NewProtocol="UDP")
|
service.DeletePortMapping(
|
||||||
|
NewRemoteHost="", NewExternalPort=BS_PORT, NewProtocol="UDP")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -281,7 +280,7 @@ class Joinable(babase.Plugin):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
add_port_mapping()
|
add_port_mapping()
|
||||||
|
|
||||||
def on_app_shutdown(self) -> None:
|
def on_app_shutdown(self) -> None:
|
||||||
delete_port_mapping()
|
delete_port_mapping()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue