diff --git a/dub.json b/dub.json
index d5076dd..23a066c 100644
--- a/dub.json
+++ b/dub.json
@@ -5,7 +5,7 @@
"Oliver Rümpelein"
],
"dependencies": {
- "requests": "~>0.3.1",
+ "requests": "~>0.4.1",
"kxml": "~>1.0.1"
},
"description": "A minimal D application.",
diff --git a/source/app.d b/source/app.d
index a407ff6..ce064ab 100644
--- a/source/app.d
+++ b/source/app.d
@@ -12,11 +12,8 @@ import fahrplanparser;
import substitution;
-// find stops: http://mobile.defas-fgi.de/beg/XML_STOPFINDER_REQUEST?outputFormat=XML&stateless=1&locationServerActive=1®ionID_sf=1&type_sf=stop&name_sf=Regensburg%20Universit%C3%A4t
-
enum baseURL = "http://mobile.defas-fgi.de/beg/";
enum departureMonitorRequest = "XML_DM_REQUEST";
-enum stopFinderRequest = "XML_STOPFINDER_REQUEST";
void main(string[] args)
{
diff --git a/source/fahrplanparser.d b/source/fahrplanparser.d
index e92cb34..7860e86 100644
--- a/source/fahrplanparser.d
+++ b/source/fahrplanparser.d
@@ -21,6 +21,7 @@ template timeXPath(string _timeNodeName = timeNodeName)
{
enum timeXPath = "/st/" ~ _timeNodeName;
}
+
enum useRealTimeXPath = "/realtime";
enum lineXPath = "/m/nu";
enum directionXPath = "/m/des";
@@ -41,8 +42,8 @@ auto parsedFahrplan(in string data)
@system unittest
{
- import std.stdio;
- import std.array: array;
+ import std.array : array;
+
auto xml = "";
assert(xml.parsedFahrplan.array == []);
@@ -50,13 +51,17 @@ auto parsedFahrplan(in string data)
assert(xml.parsedFahrplan.array == []);
xml = "112246Wernerwerkstraße";
- assert(xml.parsedFahrplan.array == [["direction":"Wernerwerkstraße", "line":"6", "departure":"12:24", "delay":"18"]]);
+ assert(xml.parsedFahrplan.array == [["direction" : "Wernerwerkstraße",
+ "line" : "6", "departure" : "12:24", "delay" : "18"]]);
xml = "012246Wernerwerkstraße";
- assert(xml.parsedFahrplan.array == [["direction":"Wernerwerkstraße", "line":"6", "departure":"12:24", "delay":"0"]]);
+ assert(xml.parsedFahrplan.array == [["direction" : "Wernerwerkstraße",
+ "line" : "6", "departure" : "12:24", "delay" : "0"]]);
xml = "012246Wernerwerkstraße1135311Burgweinting";
- assert(xml.parsedFahrplan.array == [["direction":"Wernerwerkstraße", "line":"6", "departure":"12:24", "delay":"0"], ["direction":"Burgweinting", "line":"11", "departure":"13:53", "delay":"3"]]);
+ assert(xml.parsedFahrplan.array == [["direction" : "Wernerwerkstraße", "line" : "6",
+ "departure" : "12:24", "delay" : "0"], ["direction" : "Burgweinting",
+ "line" : "11", "departure" : "13:53", "delay" : "3"]]);
}
private:
@@ -125,13 +130,13 @@ in
}
body
{
- auto useRealtimeString = dp.parseXPath(useRealTimeXPath).front.getCData;
+ immutable useRealtimeString = dp.parseXPath(useRealTimeXPath).front.getCData;
if (useRealtimeString == "0")
return dur!"minutes"(0);
else if (useRealtimeString == "1")
{
- auto expectedTime = dp.departureTime;
- auto realTime = dp.departureTime!realTimeNodeName;
+ immutable expectedTime = dp.departureTime;
+ immutable realTime = dp.departureTime!realTimeNodeName;
auto timeDiff = realTime - expectedTime;
if (timeDiff < dur!"minutes"(0))
timeDiff = dur!"hours"(24) + timeDiff;