Invert connection list (i.e. latest first) if searching for connections by arrival time
This commit is contained in:
parent
4b5a4516ae
commit
609194dd97
|
@ -92,7 +92,7 @@ def getDetails(cid, url, q, via = [], eq = None):
|
||||||
iq = queue.PriorityQueue()
|
iq = queue.PriorityQueue()
|
||||||
|
|
||||||
for line in range(0, len(lines), 3):
|
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()
|
t.start()
|
||||||
threads += [t]
|
threads += [t]
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ def connRequest(frm, to, count = 3, time = datetime.datetime.now(), mode = False
|
||||||
q = queue.PriorityQueue()
|
q = queue.PriorityQueue()
|
||||||
|
|
||||||
for i in range(len(conns)):
|
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()
|
t.start()
|
||||||
threads += [t]
|
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):
|
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 = 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"?>
|
output = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<connections>
|
<connections>
|
||||||
|
|
|
@ -75,7 +75,7 @@ def daRequest(station, count = 3, time = datetime.datetime.now(), mode = False,
|
||||||
q = queue.PriorityQueue()
|
q = queue.PriorityQueue()
|
||||||
|
|
||||||
for i in range(len(services)):
|
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()
|
t.start()
|
||||||
threads += [t]
|
threads += [t]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue