ZoneMinder / pyzm

Python API, Log, Event Server and Memory wrapper for ZoneMinder
GNU General Public License v2.0
32 stars 21 forks source link

Fix bug where ml_overrides pattern was always ignored #49

Closed jantman closed 8 months ago

jantman commented 8 months ago

The current pyzm code contains this line:

if self.ml_overrides.get(seq,{}).get('pattern') and False:

That always evaluates to False, and as such, the pattern from ml_overrides is never used. When using mlapi, this makes it impossible to override the mlapi configuration pattern via parameters passed in via a zm_detect request. This PR fixes that issue, so that zm_detect can override patterns on a global, per-monitor, or per-zone basis as described in the documentation.

This PR also includes some additional Debug 2 logging to assist in troubleshooting issues like this, and replaces a copy operation on the polygons list with a deepcopy, as copies of nested data structures should generally be deep as opposed to shallow.