ZoneMinder / pyzm

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

Added the 'running' function to determine if the ZoneMinder server is running #3

Closed joro75 closed 3 years ago

joro75 commented 4 years ago

Added the the 'running' function to ZMApi, which can be used to determine if the ZoneMinder is running or not. Using the 'start' or 'stop' functions this 'running' state can then be changed.

pliablepixels commented 4 years ago

What on earth! I never received any notifications of any of these PRS! I'll look into them this weekend. Are the issues still valid?

pliablepixels commented 4 years ago

The intent of this api almost seems to be a True or False whereas we are returning the HTTP response of daemonCheck. How about we simplify the response, or modify the API intent?

joro75 commented 3 years ago

I agree that the 'running' function indeed seems to indicate that a True or False value is being returned. This is however not the case as it is returning the JSON response of the query. It is indeed confusing. I initially chose to return the JSON response as this is also the behaviour of the 'start', 'stop', 'restart' and 'set_state' functions. I wanted to maintain a similar behaviour.

I do prefer to change the API of the 'running' function to just return a single boolean value. If you agree, I can adjust the 'running' function.

pliablepixels commented 3 years ago

How about we return a JSON object: isRunning: true/false responseText: whatever daemonCheck responds?

joro75 commented 3 years ago

Also OK. I will modify the implementation to return a JSON object as you suggested. Will try to do it in within 2 weeks.

joro75 commented 3 years ago

Sorry, made a mesh of the rebase and the previous commit. Let's close this Pull Request, and forget it's change.