diff --git a/app/ftp.py b/app/ftp.py index 0238e565..0627a17e 100644 --- a/app/ftp.py +++ b/app/ftp.py @@ -50,11 +50,11 @@ def upload_data(*, properties, download_type=DownloadDataType.ALL, remove_unused # telnet tn = telnet(host=host) next(tn) + # terminate enigma + tn.send("init 4") with FTP(host=host) as ftp: ftp.login(user=properties["user"], passwd=properties["password"]) - # terminate enigma - tn.send("init 4") if download_type is DownloadDataType.ALL or download_type is DownloadDataType.SATELLITES: ftp.cwd(properties["satellites_xml_path"]) @@ -88,13 +88,13 @@ def send_file(file_name, path, ftp): return ftp.storbinary("STOR " + file_name, f) -def telnet(host, port=23, user="root", password="root", timeout=2): +def telnet(host, port=23, user="root", password="root", timeout=1): try: tn = Telnet(host=host, port=port, timeout=timeout) except socket.timeout: print("socket timeout") else: - time.sleep(1) + time.sleep(timeout) command = yield tn.write("{}\r\n".format(command).encode("utf-8")) time.sleep(timeout) diff --git a/app/ui/satellites_dialog.py b/app/ui/satellites_dialog.py index 4f629f52..f14f5336 100644 --- a/app/ui/satellites_dialog.py +++ b/app/ui/satellites_dialog.py @@ -250,7 +250,7 @@ class SatellitesDialog: model = view.get_model() satellites = [] model.foreach(self.parse_data, satellites) - write_satellites(satellites, self._data_path + "tmp/") # temporary!!! + write_satellites(satellites, self._data_path) @staticmethod def parse_data(model, path, itr, sats):