mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 00:09:55 +00:00
autocomplete parses stationid where possible
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@129 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
d0162ed846
commit
c632118a6e
6 changed files with 36 additions and 19 deletions
|
@ -57,7 +57,8 @@ public final class VbbProvider implements NetworkProvider
|
|||
private static final Pattern P_AUTOCOMPLETE_IS_MAST = Pattern.compile("\\d{6}");
|
||||
private static final String AUTOCOMPLETE_NAME_URL = "http://mobil.bvg.de/Fahrinfo/bin/stboard.bin/dox/dox?input=";
|
||||
private static final Pattern P_SINGLE_NAME = Pattern.compile(".*Haltestelleninfo.*?<strong>(.*?)</strong>.*", Pattern.DOTALL);
|
||||
private static final Pattern P_MULTI_NAME = Pattern.compile("<a href=\\\"/Fahrinfo/bin/stboard.*?\\\">\\s*(.*?)\\s*</a>", Pattern.DOTALL);
|
||||
private static final Pattern P_MULTI_NAME = Pattern.compile("<a href=\\\"/Fahrinfo/bin/stboard\\.bin/dox.*?input=(\\d+)&.*?\">\\s*(.*?)\\s*</a>",
|
||||
Pattern.DOTALL);
|
||||
private static final String AUTOCOMPLETE_MASTID_URL = "http://mobil.bvg.de/IstAbfahrtzeiten/index/mobil?input=";
|
||||
private static final Pattern P_SINGLE_MASTID = Pattern.compile(".*Ist-Abfahrtzeiten.*?<strong>(.*?)</strong>.*", Pattern.DOTALL);
|
||||
|
||||
|
@ -72,7 +73,7 @@ public final class VbbProvider implements NetworkProvider
|
|||
final Matcher mSingle = P_SINGLE_MASTID.matcher(page);
|
||||
if (mSingle.matches())
|
||||
{
|
||||
results.add(new Autocomplete(0, ParserUtils.resolveEntities(mSingle.group(1))));
|
||||
results.add(new Autocomplete(0 /* TODO */, ParserUtils.resolveEntities(mSingle.group(1))));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -82,13 +83,13 @@ public final class VbbProvider implements NetworkProvider
|
|||
final Matcher mSingle = P_SINGLE_NAME.matcher(page);
|
||||
if (mSingle.matches())
|
||||
{
|
||||
results.add(new Autocomplete(0, ParserUtils.resolveEntities(mSingle.group(1))));
|
||||
results.add(new Autocomplete(0 /* TODO */, ParserUtils.resolveEntities(mSingle.group(1))));
|
||||
}
|
||||
else
|
||||
{
|
||||
final Matcher mMulti = P_MULTI_NAME.matcher(page);
|
||||
while (mMulti.find())
|
||||
results.add(new Autocomplete(0, ParserUtils.resolveEntities(mMulti.group(1))));
|
||||
results.add(new Autocomplete(Integer.parseInt(mMulti.group(1)), ParserUtils.resolveEntities(mMulti.group(2))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue