15 | #Subject: --new video detected--
16 | #
17 | #Check the new video."""
18 |
19 | from email.mime.text import MIMEText
20 | from email.mime.multipart import MIMEMultipart
21 | from email.mime.image import MIMEImage
22 |
23 |
24 | fromaddr = "sunny......@gmail.com"
25 | toaddr = "sunny.ch.....@city.ac.uk"
26 |
27 |
28 | def attached_text_and_image(image):
29 | msg = MIMEMultipart()
30 | msg['From'] = fromaddr
31 | msg['To'] = toaddr
32 | body = "Check the new video."
33 | msg.attach(MIMEText(body, 'plain'))
34 | msg['Subject'] = "--new video detected--"
35 |
36 | #msgAlternative = MIMEMultipart('alternative')
37 | # Create the body of the message (a plain-text and an HTML version).
38 | text = "Hi!\nHow are you?\nHere are the links you wanted:\n\nwindows-dell: 192.168.0.70:5000\nor\nrasp-pi: 192.168.0.85:5000"
39 | html = """\
40 |
41 |
42 |
43 | Hi!
44 | How are you?\n
45 | Here is the global streaming link using localtunnel
46 |
47 |
48 |
49 | """
50 | # Record the MIME types of both parts - text/plain and text/html.
51 | part1 = MIMEText(text, 'plain')
52 | part2 = MIMEText(html, 'html')
53 |
54 | # Attach parts into message container.
55 | # According to RFC 2046, the last part of a multipart message, in this case
56 | # the HTML message, is best and preferred.
57 | msg.attach(part1)
58 | msg.attach(part2)
59 |
60 | with open(image, 'rb') as fp:
61 | img = MIMEImage(fp.read())
62 | msg.attach(img)
63 |
64 | text = msg.as_string()
65 | server.sendmail(fromaddr, toaddr, text)
66 |
67 |
68 | def quit_server():
69 | server.quit()
70 |
--------------------------------------------------------------------------------
/sending_messages_using_twilio.py:
--------------------------------------------------------------------------------
1 |
2 | from twilio.rest import Client
3 |
4 | def send_msg():
5 | # Your Account SID from twilio.com/console
6 | account_sid = "ACc2e9f381a58e......................"
7 | # Your Auth Token from twilio.com/console
8 | auth_token = "3fd4d393b72c......................."
9 |
10 | client = Client(account_sid, auth_token)
11 |
12 | message = client.messages.create(
13 | to="+447438........",
14 | from_="+44124......",
15 | body="--new video received--")
16 |
--------------------------------------------------------------------------------
/sync_using_dropbox_rpi.py:
--------------------------------------------------------------------------------
1 | import subprocess
2 |
3 | def sync_folder():
4 |
5 | upload = "/home/pi/object_detection_cv2_tf_dn/Dropbox-uploader/dropbox_uploader.sh upload /home/pi/object_detection_cv2_tf_dn/dropbox_sync_folder_4_videos/ /"
6 | print('sync_dropbox_activated')
7 | subprocess.call ([upload], shell=True)
8 | print('sync_dropbox_finished')
9 |
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Video Streaming Demonstration
4 |
5 |
6 | Video Streaming Demonstration
7 |
8 |
9 |
--------------------------------------------------------------------------------