OpenLake / Smart-Cams

Give superpowers to your CCTV/Mobile cameras with Computer vision 📷🤖
5 stars 6 forks source link

Improving the Implementation of the stop_key of Video_Recorder #11

Open Dhruv88 opened 3 years ago

Dhruv88 commented 3 years ago

Currently there are two issues with the stop_key: 1.) When stop_key corresponding to a stream is pressed it stops the recording but it does not change the enabled property of that stream to False in the database. 2.)The stop_key is assigned by converting the id of the stream to which it corresponds, into a string. Now this stop_key is compared with cv2.waitKey(1) to check if user has pressed the key to stop that stream. The problem occurs when the id becomes 2-digit. Now the mentioned comparison is between a string of length two and a character which causes an error.

Steps to reproduce 1: 1.)Create a stream/Enable an existing stream. The recording will start and a window showing the stream will appear 2.)Now stop the stream by pressing the corresponding stop_key(For eg: if stream_id=1 then press the numeric key 1 on keyboard). The stream stops but in the database the enabled property of that stream is still True.

Steps to reproduce 2: Create new streams till the stream_id becomes a 2-digit number. As soon as this happens error will occur at the comparison mentioned above.

Possible Fixes for 1: When the stop_key is pressed a put request can be made to update the enabled property of the stream that is being stopped or if stream instance is passes to the Video_Recorder then the property can be updated directly from there.

Possible Fixes for 2: Implement a feature where user can enter the id of the stream and press enter to close it or even can use the mouse to close the window.