mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 14:38:49 +00:00
adapt to changes to Frankfurt
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@642 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
17f47ea936
commit
77b80edd55
2 changed files with 12 additions and 4 deletions
|
@ -186,7 +186,7 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
private static final Pattern P_PRE_ADDRESS = Pattern.compile("(?:Geben Sie einen (Startort|Zielort) an.*?)?Bitte wählen Sie aus der Liste",
|
||||
Pattern.DOTALL);
|
||||
private static final Pattern P_ADDRESSES = Pattern.compile(
|
||||
"<span class=\"tplight\">.*?<a href=\"http://www.rmv.de/auskunft/bin/jp/query.exe/dox.*?\">\\s*(.*?)\\s*</a>.*?</span>", Pattern.DOTALL);
|
||||
"<span class=\"tplight\">.*?<a href=\"/auskunft/bin/jp/query.exe/dox.*?\">\\s*(.*?)\\s*</a>.*?</span>", Pattern.DOTALL);
|
||||
private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern.compile(
|
||||
"(mehrfach vorhanden oder identisch)|(keine geeigneten Haltestellen)|(keine Verbindung gefunden)|(derzeit nur Auskünfte vom)",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
@ -254,7 +254,7 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
, Pattern.DOTALL);
|
||||
private static final Pattern P_CONNECTIONS_COARSE = Pattern.compile("<p class=\"con(?:L|D)\">(.+?)</p>", Pattern.DOTALL);
|
||||
private static final Pattern P_CONNECTIONS_FINE = Pattern.compile(".*?" //
|
||||
+ "<a href=\"(http://www.rmv.de/auskunft/bin/jp/query.exe/dox[^\"]*?)\">" // link
|
||||
+ "<a href=\"(/auskunft/bin/jp/query.exe/dox[^\"]*?)\">" // link
|
||||
+ "(\\d+:\\d+)-(\\d+:\\d+)</a>" // departureTime, arrivalTime
|
||||
+ "(?: (.+?))?" // line
|
||||
, Pattern.DOTALL);
|
||||
|
@ -287,7 +287,7 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
final Matcher mConFine = P_CONNECTIONS_FINE.matcher(mConCoarse.group(1));
|
||||
if (mConFine.matches())
|
||||
{
|
||||
final String link = ParserUtils.resolveEntities(mConFine.group(1));
|
||||
final String link = "http://www.rmv.de" + ParserUtils.resolveEntities(mConFine.group(1));
|
||||
final Calendar departureTime = new GregorianCalendar(timeZone());
|
||||
departureTime.setTimeInMillis(currentDate.getTimeInMillis());
|
||||
ParserUtils.parseEuropeanTime(departureTime, mConFine.group(2));
|
||||
|
@ -330,7 +330,7 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
, Pattern.DOTALL);
|
||||
private static final Pattern P_CONNECTION_DETAILS_COARSE = Pattern.compile("/b> -\n(.*?- <b>[^<]*)<", Pattern.DOTALL);
|
||||
private static final Pattern P_CONNECTION_DETAILS_FINE = Pattern.compile("<br />\n" //
|
||||
+ "(?:(.*?) nach (.*?)\n" // line, destination
|
||||
+ "(?:(.*?) nach ([^\n]*)\n" // line, destination
|
||||
+ "<br />\n" //
|
||||
+ "ab (\\d{1,2}:\\d{2})\n" // plannedDepartureTime
|
||||
+ "(?:<span class=\"red\">\nca\\.(\\d{1,2}:\\d{2})\n</span>\n)?" // predictedDepartureTime
|
||||
|
|
|
@ -82,4 +82,12 @@ public class RmvProviderLiveTest
|
|||
provider.getConnectionDetails(connection.link);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortConnectionByName() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ANY, 0, null, "Hanau Hauptbahnhof"), null,
|
||||
new Location(LocationType.ANY, 0, null, "Frankfurt Hauptbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue