Monitor eventManager and grep events for further processing Telegram, Pushover etc.

lxi2019

n3wb
Jun 9, 2021
3
1
Germany
Hi! I monitor the output of:

curl -s --digest ""

and get this on motion events:

Code:
..SOME-OTHER-OUTPUT
Code=NewFile;action=Pulse;index=0;data={
   "File" : "ftp:\/\/10.30.50.1\/cam\/camera\/Terrasse\/2021-07-03\/001_20.28.31_A_0_0_0.mp4",
   "Size" : 9389611,
   "StoragePoint" : "NULL"
}
SOME-OTHER-OUTPUT..

I know how to grep things from curl, but not from running curl events. Is curl the right tool for that?
my idea is to monitor events and if something with mp4 or jpeg happens, grep the line with the ftp-url and send a message with picture or movie to my telegram.
any ideas? I know the rest but don't know how to deal with the running curl command

thank you
 
I use NodeRed
1 - check eventManager.cgi?action=getEventIndexes&code=VideoMotion
2 - if msg.payload = "Motion!"
3 - make snapshot.cgi?[channel=0]
4 - send picture to Telegram
 
Thank you but I want something in a shell script.
btw you don’t need to take a Snapshot.You can grab the saved picture from your save space. FTP, SFTP..
the url is present in the event
 
Either I don't understand how it works. Either it doesn't work. Or I don't know how to run it. To test it, I make a request from POSTMAN. digest authorization, request to my-ip/cgi-bin/eventManager.cgi?action=attach&codes=[All]&heartbeat=5. A person entered the camera area, the recording was saved, but there was no response. At this point POSTMAN has been running for 2 hours, no response, however 2 videos have already been saved to the camera. And I still don't understand. Once the event happens, does it send a response 200 or what? What confuses me is that the documentation has multiple responses separated by --myboundary. How is it possible to have multiple responses all the time?