def launch_a_browser(url, force=False): """ Launch a browser pointing to the URL """ if not force and not cfg.autobrowser() or sabnzbd.DAEMON: return if '::1' in url and '[::1]' not in url: # Get around idiosyncrasy in Python runtime url = url.replace('::1', '[::1]') if cfg.enable_https() and not cfg.https_port.get_int(): # Must use https, because http is not available url = url.replace('http:', 'https:') if 'localhost' in url and not cfg.ipv6_hosting(): url = url.replace('localhost', '127.0.0.1') logging.info("Launching browser with %s", url) try: if url and not url.startswith('http'): url = 'file:///%s' % url if webbrowser: webbrowser.open(url, 2, 1) else: logging.info( 'Not showing panic message in webbrowser, no support found') except: logging.warning(T('Cannot launch the browser, probably not found')) logging.info("Traceback: ", exc_info=True)
def launch_a_browser(url, force=False): """ Launch a browser pointing to the URL """ if not force and not cfg.autobrowser() or sabnzbd.DAEMON: return if "::1" in url and "[::1]" not in url: # Get around idiosyncrasy in Python runtime url = url.replace("::1", "[::1]") if cfg.enable_https() and not cfg.https_port.get_int(): # Must use https, because http is not available url = url.replace("http:", "https:") if "localhost" in url and not cfg.ipv6_hosting(): url = url.replace("localhost", "127.0.0.1") logging.info("Launching browser with %s", url) try: if url and not url.startswith("http"): url = "file:///%s" % url if webbrowser: webbrowser.open(url, 2, 1) else: logging.info("Not showing panic message in webbrowser, no support found") except: logging.warning(T("Cannot launch the browser, probably not found")) logging.info("Traceback: ", exc_info=True)
def launch_a_browser(url, force=False): """ Launch a browser pointing to the URL """ if not force and not cfg.autobrowser() or sabnzbd.DAEMON: return if '::1' in url and '[::1]' not in url: # Get around idiosyncrasy in Python runtime url = url.replace('::1', '[::1]') if cfg.enable_https() and not cfg.https_port.get_int(): # Must use https, because http is not available url = url.replace('http:', 'https:') if 'localhost' in url and not cfg.ipv6_hosting(): url = url.replace('localhost', '127.0.0.1') logging.info("Launching browser with %s", url) try: if url and not url.startswith('http'): url = 'file:///%s' % url if webbrowser: webbrowser.open(url, 2, 1) else: logging.info('Not showing panic message in webbrowser, no support found') except: logging.warning(T('Cannot launch the browser, probably not found')) logging.info("Traceback: ", exc_info=True)