mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-20 09:19:57 +00:00
locationId in QueryDeparturesResult
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@17 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
1315484d07
commit
f505d2eda8
5 changed files with 34 additions and 7 deletions
|
@ -474,11 +474,17 @@ public class MvvProvider implements NetworkProvider
|
|||
+ "<td width=\"100\">\\s*([^<]*?)[\\xa0\\s]*(?:<a .*?</a>.*?)?" // line
|
||||
+ "<br />\\s*(.*?)\\s*<br />.*?" // destination
|
||||
+ "</td>.*?", Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("nameInfo_dm=(\\d+)");
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final String uri) throws IOException
|
||||
{
|
||||
final CharSequence page = ParserUtils.scrape(uri);
|
||||
|
||||
final Matcher mStationId = P_DEPARTURES_URI_STATION_ID.matcher(uri);
|
||||
if (!mStationId.find())
|
||||
throw new IllegalStateException(uri);
|
||||
final int stationId = Integer.parseInt(mStationId.group(1));
|
||||
|
||||
final Matcher mHead = P_DEPARTURES_HEAD.matcher(page);
|
||||
if (mHead.matches())
|
||||
{
|
||||
|
@ -514,7 +520,7 @@ public class MvvProvider implements NetworkProvider
|
|||
}
|
||||
}
|
||||
|
||||
return new QueryDeparturesResult(uri, location, currentTime, departures);
|
||||
return new QueryDeparturesResult(uri, stationId, location, currentTime, departures);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue