Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.system("MP4Box -add " + video_name + h264_video + " " + video_name +
- mp4_video)
- os.system("rm " + video_name + h264_video)
- footage = video_name + mp4_video
- f_time = datetime.now().strftime("%A %B %d %Y @ %H:%M:%S")
- msg = MIMEMultipart()
- msg["Subject"] = f_time
- msg["From"] = "xxxxxx@gmail.com"
- msg["To"] = "xxxxx@gmail.com"
- text = MIMEText(" Motion Detected ")
- msg.attach(text)
- part = MIMEBase("application", "octet-stream")
- part.set_payload(open(footage, "rb").read())
- email.encoders.encode_base64(part)
- part.add_header("Content-Disposition", "attachment; filename= %s" %
- os.path.basename(footage))
- msg.attach(part)
- server = smtplib.SMTP("smtp.gmail.com:587")
- server.starttls()
- server.login("xxxxx@gmail.com","xxxxx")
- server.sendmail("xxxxxx@gmail.com", "xxxxxx@gmail.com", msg.as_string())
- server.quit()
- os.system("rm " + footage)
- print(message.sid)
- elif gpio.input(pir1)==0 and gpio.input(pir2)==1 :
- print " PIR2 Motion detected!"
- gpio.output(relay, HIGH)
- start_recording_video()
- sending_a_text_message_2()
- while(gpio.input(pir1)==0 and gpio.input(pir2)==1):
- time.sleep(1)
- else:
- gpio.output(relay, LOW)
- time.sleep(0.01)
Add Comment
Please, Sign In to add comment