Invert connection list (i.e. latest first) if searching for connections by arrival time

This commit is contained in:
Klaus-Uwe Mitterer 2017-11-16 19:13:59 +01:00
parent 4b5a4516ae
commit 609194dd97
2 changed files with 4 additions and 3 deletions

View File

@ -92,7 +92,7 @@ def getDetails(cid, url, q, via = [], eq = None):
iq = queue.PriorityQueue()
for line in range(0, len(lines), 3):
t = threading.Thread(target=getService, args=(line, lines[line:line + 3], iq, eq))
t = threading.Thread(target=getService, args=(line, lines[line:line + 3], iq, eq), daemon = True)
t.start()
threads += [t]
@ -158,7 +158,7 @@ def connRequest(frm, to, count = 3, time = datetime.datetime.now(), mode = False
q = queue.PriorityQueue()
for i in range(len(conns)):
t = threading.Thread(target=getDetails, args=(i, conns[i], q, via, eq))
t = threading.Thread(target=getDetails, args=(i, conns[i], q, via, eq), daemon = True)
t.start()
threads += [t]
@ -216,6 +216,7 @@ def connRequest(frm, to, count = 3, time = datetime.datetime.now(), mode = False
def worker(frm, to, count = 3, time = datetime.datetime.now(pytz.timezone("Europe/Vienna")), mode = False, details = False, json = False, via = None):
conns = list(connRequest(getStation(frm), getStation(to), count, time, mode, details, [getStation(vst) for vst in via] if via else []))
conns = conns[::-1] if mode else conns
output = """<?xml version="1.0" encoding="UTF-8"?>
<connections>

View File

@ -75,7 +75,7 @@ def daRequest(station, count = 3, time = datetime.datetime.now(), mode = False,
q = queue.PriorityQueue()
for i in range(len(services)):
t = threading.Thread(target=getService, args=(i, services[i][0], services[i][1], q, eq))
t = threading.Thread(target=getService, args=(i, services[i][0], services[i][1], q, eq), daemon = True)
t.start()
threads += [t]