little cleaning

This commit is contained in:
Dmitriy Yefremov
2017-11-12 23:39:27 +03:00
parent e74b3a91f6
commit 18d3e2b73c
2 changed files with 5 additions and 5 deletions

View File

@@ -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)

View File

@@ -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):