Skip to content

Commit

Permalink
#9 Client script added
Browse files Browse the repository at this point in the history
  • Loading branch information
kcuric committed Jan 3, 2020
1 parent 2899e9f commit c18d005
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
8 changes: 8 additions & 0 deletions client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from modules.Streamer import Streamer

def main():
stream = Streamer('35.204.145.0', 5005, 0)
stream.send_to_server()

if __name__ == "__main__":
main()
5 changes: 2 additions & 3 deletions modules/Recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def __init__(self, camera_num):
camera_num(int) id of the camera you want to capture with
'''
self.video = cv2.VideoCapture(camera_num)
self.video.set(3, 480)
self.video.set(4, 360)

def __del__(self):
'''
Expand All @@ -29,6 +31,3 @@ def get_frame(self) -> str:
jpeg_encoded_image = jpeg.tostring()
return jpeg_encoded_image

#class testing:
#camera_one = Recorder(0)
#print(camera_one.get_frame())
2 changes: 1 addition & 1 deletion modules/Streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def send_to_server(self):
while True:
frame = self.camera.get_frame()
length = len(frame)
# print("Len: " + str(length))
if(length < 65536):
self.sock.sendto(frame, self.server_address)
print("sent to server")
14 changes: 14 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DIY Survailence System</title>
</head>
<body>
<h1>DIY Survailence System</h1>
<p>Running the app.py</p>
<img src="{{ url_for('video_feed') }}">
</body>
</html>

0 comments on commit c18d005

Please sign in to comment.