parse station ids in get_stops correctly
This commit is contained in:
parent
99f38d368f
commit
56636be4cf
1 changed files with 8 additions and 3 deletions
11
parser.py
11
parser.py
|
@ -131,8 +131,10 @@ def get_departures(station, dt):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_stops(train, dep_station, arr_station, dt):
|
def get_stops(train, dep_station, arr_station, dt):
|
||||||
if isinstance(station, str):
|
if isinstance(dep_station, str):
|
||||||
station = parse_i(get_id(station))["L"]
|
station = parse_i(get_id(dep_station))["L"]
|
||||||
|
if isinstance(arr_station, str):
|
||||||
|
station = parse_i(get_id(arr_station))["L"]
|
||||||
req = Request("http://mobile.bahn.de/bin/mobil/bhftafel.exe/dn?",
|
req = Request("http://mobile.bahn.de/bin/mobil/bhftafel.exe/dn?",
|
||||||
urlencode({
|
urlencode({
|
||||||
"start":"yes",
|
"start":"yes",
|
||||||
|
@ -163,6 +165,8 @@ def get_stops(train, dep_station, arr_station, dt):
|
||||||
result.append(s)
|
result.append(s)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
print get_stops('RE 36072', 8010334, 8010310, datetime(2010, 06, 18, 15, 43))
|
||||||
|
|
||||||
#late:
|
#late:
|
||||||
#http://mobile.bahn.de/bin/mobil/bhftafel.exe/dn?
|
#http://mobile.bahn.de/bin/mobil/bhftafel.exe/dn?
|
||||||
# start=yes
|
# start=yes
|
||||||
|
@ -481,8 +485,9 @@ a = PlnParse(f)
|
||||||
#def bin(i):
|
#def bin(i):
|
||||||
# return "".join(str((i >> y) & 1) for y in range(16-1, -1, -1))
|
# return "".join(str((i >> y) & 1) for y in range(16-1, -1, -1))
|
||||||
#print a.timetable_info
|
#print a.timetable_info
|
||||||
|
from pprint import pprint
|
||||||
for conn in a.connections:
|
for conn in a.connections:
|
||||||
print conn
|
pprint(conn)
|
||||||
#for conn in a.connections:
|
#for conn in a.connections:
|
||||||
# print "\t".join([conn["freq"][0], bin(conn["freq"][1]), bin(conn["freq"][2]), bin(conn["freq"][3])])
|
# print "\t".join([conn["freq"][0], bin(conn["freq"][1]), bin(conn["freq"][2]), bin(conn["freq"][3])])
|
||||||
#for conn in a.connections:
|
#for conn in a.connections:
|
||||||
|
|
Loading…
Reference in a new issue