Browse Source

Update import of sabnzbd.getipaddress

pull/1651/head
Safihre 5 years ago
parent
commit
b1f6448ae0
  1. 14
      SABnzbd.py
  2. 4
      sabnzbd/zconfig.py

14
SABnzbd.py

@ -76,7 +76,7 @@ import sabnzbd.cfg
import sabnzbd.downloader
import sabnzbd.notifier as notifier
import sabnzbd.zconfig
from sabnzbd.getipaddress import localipv4
from sabnzbd.getipaddress import localipv4, publicipv4, ipv6
try:
import win32api
@ -1195,9 +1195,6 @@ def main():
ctx = ssl.create_default_context()
logging.debug("Available certificates: %s", repr(ctx.cert_store_stats()))
# Show IPv4/IPv6 address
from sabnzbd.getipaddress import localipv4, publicipv4, ipv6
mylocalipv4 = localipv4()
if mylocalipv4:
logging.debug("My local IPv4 address = %s", mylocalipv4)
@ -1478,22 +1475,21 @@ def main():
check_latest_version()
autorestarted = False
# ZeroConfig/Bonjour needs an ip. Lets try to find it.
# bonjour/zeroconf needs an ip. Lets try to find it.
z_host = localipv4() # IPv4 address of the LAN interface. This is the normal use case
if not z_host:
# None, so no network / default route, so let's set to ...
z_host = "127.0.0.1"
if probablyipv4(cherryhost) and not cherryhost in [
elif probablyipv4(cherryhost) and cherryhost not in (
"localhost",
"127.0.0.1",
"::1",
"0.0.0.0",
"",
"::",
]:
):
# a hard-configured cherryhost other than the usual, so let's take that (good or wrong)
z_host = cherryhost
logging.debug("bonjour/zeroconf: Using ", z_host)
logging.debug("bonjour/zeroconf using host: %s", z_host)
sabnzbd.zconfig.set_bonjour(z_host, cherryport)
# Have to keep this running, otherwise logging will terminate

4
sabnzbd/zconfig.py

@ -68,7 +68,7 @@ def set_bonjour(host=None, port=None):
global _HOST_PORT, _BONJOUR_OBJECT
if not _HAVE_BONJOUR or not cfg.enable_bonjour():
logging.info("No Bonjour/ZeroConfig support installed")
logging.info("No bonjour/zeroconf support installed")
return
if host is None and port is None:
@ -81,7 +81,7 @@ def set_bonjour(host=None, port=None):
domain = None
if match_str(host, ("localhost", "127.", "::1")):
logging.info('Bonjour/ZeroConfig does not support "localhost"')
logging.info("bonjour/zeroconf does not support 'localhost'")
# All implementations fail to implement "localhost" properly
# A false address is published even when scope==kDNSServiceInterfaceIndexLocalOnly
return

Loading…
Cancel
Save