def select_host(): from dudehere.routines.plugin import Plugin plugin = Plugin() hosts_file = vfs.join(DATA_PATH, "hosts.json") if vfs.exists(hosts_file): history = vfs.read_file(hosts_file, json=True) hosts = ["http://%s:%s" % (h['host'], h['port']) for h in history] host = plugin.dialog_select('Select a Host', hosts) if host is not False: host = history[host] ADDON.set_setting('remote_host', host['host']) ADDON.set_setting('remote_control_port', host['port']) ADDON.set_setting('remote_auth_pin', host['pin']) else: plugin.notify("Error", "Host history is empty")