It's a fairly simple class library that lets you retrieve data from your ZoneMinder system. So far it contains stuff I had a need for when writing an application, but since the application is no longer a necessity it has more or less turned into my little playground. Currently it does not allow you to SET data, it only retrieves data.
It's fairly simple to use, I've got some examples here:
Code: Select all
void Main() {
var zm = "https://yourinstallhere/zm";
var zmapi = "https://yourinstallhere/zm/api";
var user = "user";
var pass = "password";
// Stop webrequests from throwing SSL errors. Only use it on self-signed certificates.
//ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return true; };
using (var controller = new ZoneMinderController(zm, zmapi, user, pass)) {
// If we're not authenticated, don't bother retrieving our data.
if (!controller.Authenticate()) return;
// retrieve a list of all Monitors.
var monitors = controller.GetMonitors();
// Retrieve a list of all events.
var events = controller.GetEvents();
// Retrieve our latest event and all of its information, including frames.
var eventid = controller.GetPageEvents(controller.GetPageCount()).OrderByDescending(c => c.Id).First().Id;
var eventframes = controller.GetFrames(eventid);
var eventdata = controller.GetEventData(eventid);
// Or events during a specific timeframe.
var rangeevents = controller.GetEvents(DateTime.Today.AddDays(-7), DateTime.Now) select e);
}
}
I'll likely be tinkering some more, and adding more stuff to it. I've already scrapped some ideas I had because they either didn't work or weren't feasible.. But if you want anything specific in it just let me know, I'll see what I can do. Note that it does not support (Re)Captcha, I have ways of dealing with Captcha, but ReCaptcha is just a major pain in the behind.