Fix Flarmnet import

pull/68/head
Konstantin Gründger 2018-12-08 09:00:44 +01:00
rodzic 367a6a6bf7
commit d85ed1f113
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -72,8 +72,9 @@ def import_file(path='tests/custom_ddb.txt'):
path=path)
print("Imported %i devices." % counter)
@manager.command
def import_flarmnet(path='tests/data.fln'):
def import_flarmnet(path=None):
"""Import registered devices from a local file."""
print("Import registered devices from '{}'...".format("internet" if path is None else path))
@ -82,6 +83,7 @@ def import_flarmnet(path='tests/data.fln'):
path=path)
print("Imported %i devices." % counter)
@manager.command
def import_airports(path='tests/SeeYou.cup'):
"""Import airports from a ".cup" file"""
@ -92,6 +94,7 @@ def import_airports(path='tests/SeeYou.cup'):
session.commit()
print("Imported {} airports.".format(len(airports)))
@manager.command
def update_country_codes():
"""Update country codes of all receivers."""

Wyświetl plik

@ -58,7 +58,7 @@ def get_flarmnet(fln_file=None, address_origin=DeviceInfoOrigin.flarmnet):
rows = [bytes.fromhex(line).decode('latin1') for line in r.text.split('\n') if len(line) == 172]
else:
with open(fln_file, 'r') as file:
rows = [bytes.fromhex(line.strip()).decode('latin1') for line in file.readlines() in len(line) == 172]
rows = [bytes.fromhex(line.strip()).decode('latin1') for line in file.readlines() if len(line) == 172]
device_infos = list()
for row in rows: