From c7edf9a4b8a7efa95ab0e9309b57540d328a2d8d Mon Sep 17 00:00:00 2001 From: coderick14 Date: Tue, 4 Jul 2017 18:51:26 +0530 Subject: Use model Webcam to capture images --- experiment/views.py | 1 - webcam/views.py | 22 ++-------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/experiment/views.py b/experiment/views.py index e427f77..2cf2c67 100644 --- a/experiment/views.py +++ b/experiment/views.py @@ -71,7 +71,6 @@ def client_version(req): return HttpResponse("3") @login_required(redirect_field_name=None) - def logs(req): """ Renders experimental log files to the user interface. Input: req:request object. diff --git a/webcam/views.py b/webcam/views.py index f6a1a81..54f74ee 100644 --- a/webcam/views.py +++ b/webcam/views.py @@ -4,33 +4,15 @@ import os, requests from sbhs_server import settings from django.http import HttpResponse from myadmin.views import checkadmin -from sbhs_server.tables.models import Board +from sbhs_server.tables.models import Board, Webcam - -def load_image(mid): - """ Displays the image of the SBHS onto the user screen. - - Input: mid: machine-id of the concerned SBHS. - """ -# for images on server 15, it will gstream the photos on reload - if int(mid) in range(8,17): - command = "streamer -q -f jpeg -c /dev/video" + str(mid) - command += " -o " + settings.WEBCAM_DIR + "/image" + str(mid) + ".jpeg" - os.system(command) - - else: - take_snapshot = requests.get("http://10.102.152.16:8080/webcams/%d/take_snapshot" % int(mid)) - get_image_link = "http://10.102.152.16:8080/webcams/%d/get_image_data" % int(mid) - - command = "curl -s %s > %s/image%d.jpeg" % (get_image_link, str(settings.WEBCAM_DIR), int(mid)) - os.system(command) def reload(req, mid): """ Refreshes the image of the SBHS Input: req:request object, mid: machine-id of the concerned SBHS. Output: HttpResponse object. """ - load_image(mid) + Webcam.load_image(mid) return HttpResponse("") @login_required(redirect_field_name=None) -- cgit