{"action":"created","issue":{"url":"https://api.github.com/repos/ccrisan/motioneye/issues/362","repository_url":"https://api.github.com/repos/ccrisan/motioneye","labels_url":"https://api.github.com/repos/ccrisan/motioneye/issues/362/labels{/name}","comments_url":"https://api.github.com/repos/ccrisan/motioneye/issues/362/comments","events_url":"https://api.github.com/repos/ccrisan/motioneye/issues/362/events","html_url":"https://github.com/ccrisan/motioneye/issues/362","id":189639199,"number":362,"title":"Sharing a small script for hangout alerts","user":{"login":"MourIdri","id":19348103,"avatar_url":"https://avatars.githubusercontent.com/u/19348103?v=3","gravatar_id":"","url":"https://api.github.com/users/MourIdri","html_url":"https://github.com/MourIdri","followers_url":"https://api.github.com/users/MourIdri/followers","following_url":"https://api.github.com/users/MourIdri/following{/other_user}","gists_url":"https://api.github.com/users/MourIdri/gists{/gist_id}","starred_url":"https://api.github.com/users/MourIdri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MourIdri/subscriptions","organizations_url":"https://api.github.com/users/MourIdri/orgs","repos_url":"https://api.github.com/users/MourIdri/repos","events_url":"https://api.github.com/users/MourIdri/events{/privacy}","received_events_url":"https://api.github.com/users/MourIdri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-16T09:14:04Z","updated_at":"2016-11-18T09:13:44Z","closed_at":null,"body":"Hi, \r\n\r\nHere is a a small python script that is sending alerts to a hangout user account (same can be used for facebook or twiter ). I added it in motioneye to be called after a movement is detected. \r\n\r\n#!/usr/bin/python\r\nimport  xmpp\r\njid = xmpp.protocol.JID('mycameragmailaddressthatwillinformotherofmovement@gmail.com')\r\ncl=xmpp.Client(jid.getDomain(),debug=[])\r\ncl.connect()\r\ncl.auth(jid.getNode(),'mysecretpassword')\r\ncl.send(xmpp.protocol.Message('useraddresstobeinformedofamovement@gmail.com',' ALARME !!!! UN MOUVEMENT DETECTE PAR VOTRE CAMERA!!!! CONNECTEZ VOUS VITE A VOTRE WEBCAM', typ='chat'))\r\n\r\nNOTE: I hate google because the message will be stored on a content, so, if you guys want to create a small service for your family, like I do, have your own xmpp server. More secure and less visible and of course not tracked. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ccrisan/motioneye/issues/comments/261483673","html_url":"https://github.com/ccrisan/motioneye/issues/362#issuecomment-261483673","issue_url":"https://api.github.com/repos/ccrisan/motioneye/issues/362","id":261483673,"user":{"login":"MourIdri","id":19348103,"avatar_url":"https://avatars.githubusercontent.com/u/19348103?v=3","gravatar_id":"","url":"https://api.github.com/users/MourIdri","html_url":"https://github.com/MourIdri","followers_url":"https://api.github.com/users/MourIdri/followers","following_url":"https://api.github.com/users/MourIdri/following{/other_user}","gists_url":"https://api.github.com/users/MourIdri/gists{/gist_id}","starred_url":"https://api.github.com/users/MourIdri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MourIdri/subscriptions","organizations_url":"https://api.github.com/users/MourIdri/orgs","repos_url":"https://api.github.com/users/MourIdri/repos","events_url":"https://api.github.com/users/MourIdri/events{/privacy}","received_events_url":"https://api.github.com/users/MourIdri/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T09:13:44Z","updated_at":"2016-11-18T09:13:44Z","body":"You have all the info you need in the script, but in the case of having your own xmpp server and in order to make it accessible, we should add some more details in the script. After googling a little bit, I found this one that is better than mine and you should just adapt your values : \r\n\r\n**************BEGINNING of script**************\r\n#!/usr/bin/python\r\nimport sys\r\nimport argparse\r\nimport xmpp\r\n\r\ndef main(argv):\r\n    parser = argparse.ArgumentParser()\r\n    parser.add_argument('-c', dest='contact', required=True)\r\n    parser.add_argument('-u', dest='username', required=True)\r\n    parser.add_argument('-p', dest='password', required=True)\r\n    parser.add_argument('-m', dest='message', required=False, default='')\r\n    args = parser.parse_args(argv)\r\n\r\n    if (args.message == '') and not sys.stdin.isatty():\r\n        for line in sys.stdin:\r\n            args.message = args.message + line\r\n\r\n    jid = xmpp.protocol.JID(args.username)\r\n    jabber = xmpp.Client(jid.getDomain(), debug=[])\r\n    jabber.connect(server=(jid.getDomain(), 5290) )\r\n    jabber.auth(jid.getNode(), args.password)\r\n\r\n    jabber.send(xmpp.Message(args.contact, args.message.strip()))\r\n\r\nif __name__ == \"__main__\":\r\n    main(sys.argv[1:])\r\n\r\n**************END of script**************\r\n\r\nThe script takes four paramters:\r\n\r\n-c <contact to send the message to>\r\n-u <the user to send the message from>\r\n-p <the password for the user>\r\n-m <the message, you can also set the message by piping data to the script>\r\n\r\nthen replace your command with this one : \r\n\r\nscriptname.py -c \"account@xmpp.server\" -u \"sender@example.com\" -p \"secret\" -m \"Motion has been detected in front of the house. You might want to view stream: http://publicadress:8081 \"\r\n\r\nThis should work... but be carefull with portforwarding and mail sent from outside to your personal domain. "}}
{"actor":{"display_login":"MourIdri"}}