Closed ytmytm closed 7 years ago
Check MRCI71/72 and others mentioned during weekend
It's there on MRCI72 - 2.6 to 4.6
cd ~/Projekty/magicmirror/MagicMirror
node
and paste
process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
const request = require('request');
function getMsg() {
var params;
params = {
url: "http://www.peka.poznan.pl/vm/method.vm",
form: {
method:"findMessagesForBollard",
p0:'{"symbol":"'+'MRCI71'+'"}'
}
};
return params;
}
var x = request.post(getMsg(), (error, response, body) => {
if (typeof response !== 'undefined') {
if (response.statusCode === 200) {
console.log(body);
} else {
console.log("Error getting connections " + response.statusCode);
}
} else {
console.log("Peka response undefined");
console.log(x);
console.log(error);
}
})
body = x.response.body
body = '{"success":[{"content":"INFO: Od piątku 2.06 od godz. 20:00 do niedzieli 4.06 nastąpi wstrzymanie ruchu tramwajowego na Alejach Marcinkowskiego. Zmianie ulegną trasy linii nr 2, 5, 9, 13, 16 oraz 201. Szczegóły na stronie <a href=\\"http://utn.pl/i6m0b\\">www.ztm.poznan.pl<\\/a>.","startDate":"2017-06-01T13:00:00.000Z","stopsGroups":[],"startHour":780,"endDate":"2017-06-04T23:45:00.000Z","endHour":1425}]}'
var res = JSON.parse(body)
console.log(res.success[0].content)
This is method
findMessagesForBollard
which also usesparam=symbol
(likegetTimes
) and returns HTML.This would have to use startDate/endDate to narrow down when message is visible.
Message is relevant only for selected stopID.
From R: