mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 00:39:58 +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
|
@ -401,11 +401,17 @@ public final class VbbProvider implements NetworkProvider
|
|||
+ "<td>\\s*<strong>\\s*(.*?)[\\s\\*]*</strong>.*?</td>\\s*" //
|
||||
+ "<td>\\s*<a.*?>\\s*(.*?)\\s*</a>\\s*</td>", Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_SERVICE_DOWN = Pattern.compile("Wartungsarbeiten");
|
||||
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\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));
|
||||
|
||||
if (P_DEPARTURES_SERVICE_DOWN.matcher(page).find())
|
||||
return QueryDeparturesResult.SERVICE_DOWN;
|
||||
|
||||
|
@ -435,7 +441,7 @@ public final class VbbProvider 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