diff --git a/resources/lib/webdialogue.py b/resources/lib/webdialogue.py index 8827a9b9..04665293 100644 --- a/resources/lib/webdialogue.py +++ b/resources/lib/webdialogue.py @@ -13,19 +13,26 @@ class WebDialogue(object): - def __init__(self): + def __init__(self, bind_interface="", port=3145): + """ Initializes a WebDialogue object. + + :param str bind_interface: The interface to bind the http server to. + :param int port: The TCP port number to bind to. + + """ + + self.bind_interface = bind_interface + self.port = port self.__value = None return # noinspection PyCompatibility - def input(self, heading, text, time_out=30, bind_interface="", port=3145): + def input(self, heading, text, time_out=30): """ Show an input dialog. :param str|int heading: Dialog heading. :param str|int text: Default value. :param int time_out: Seconds to autoclose dialog (default=do not autoclose). - :param str bind_interface: The interface to bind the http server to. - :param int port: The TCP port number to bind to. :return: Returns the entered data as a string. Returns an empty string if dialog was canceled. :rtype: str @@ -37,7 +44,7 @@ def input(self, heading, text, time_out=30, bind_interface="", port=3145): if isinstance(text, int): text = LanguageHelper.get_localized_string(text) - server_address = (bind_interface, port) + server_address = (self.bind_interface, self.port) try: # noinspection PyUnresolvedReferences @@ -250,7 +257,7 @@ def force_stop(self): th.daemon = True th.start() - Logger.info("RetroServer: Serving on %s", port) + Logger.info("RetroServer: Serving on %s", self.port) d = xbmcgui.DialogProgress() # TODO: Translate @@ -293,7 +300,9 @@ def force_stop(self): httpd.force_stop() if th.is_alive(): th.join() - th = None + + # noinspection PyUnusedLocal + th = None # NOSONAR return httpd.value, httpd.cancelled except: Logger.critical("RetroServer: Error with WebDialogue", exc_info=True)