Guest User

Untitled

a guest
Jan 27th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. os.system("MP4Box -add " + video_name + h264_video + " " + video_name +
  2. mp4_video)
  3.  
  4. os.system("rm " + video_name + h264_video)
  5. footage = video_name + mp4_video
  6.  
  7. f_time = datetime.now().strftime("%A %B %d %Y @ %H:%M:%S")
  8. msg = MIMEMultipart()
  9. msg["Subject"] = f_time
  10. msg["From"] = "xxxxxx@gmail.com"
  11. msg["To"] = "xxxxx@gmail.com"
  12. text = MIMEText(" Motion Detected ")
  13. msg.attach(text)
  14.  
  15. part = MIMEBase("application", "octet-stream")
  16. part.set_payload(open(footage, "rb").read())
  17. email.encoders.encode_base64(part)
  18. part.add_header("Content-Disposition", "attachment; filename= %s" %
  19. os.path.basename(footage))
  20. msg.attach(part)
  21.  
  22. server = smtplib.SMTP("smtp.gmail.com:587")
  23. server.starttls()
  24. server.login("xxxxx@gmail.com","xxxxx")
  25. server.sendmail("xxxxxx@gmail.com", "xxxxxx@gmail.com", msg.as_string())
  26. server.quit()
  27.  
  28. os.system("rm " + footage)
  29.  
  30. print(message.sid)
  31.  
  32. elif gpio.input(pir1)==0 and gpio.input(pir2)==1 :
  33. print " PIR2 Motion detected!"
  34. gpio.output(relay, HIGH)
  35. start_recording_video()
  36. sending_a_text_message_2()
  37. while(gpio.input(pir1)==0 and gpio.input(pir2)==1):
  38. time.sleep(1)
  39.  
  40. else:
  41. gpio.output(relay, LOW)
  42. time.sleep(0.01)
Add Comment
Please, Sign In to add comment