summaryrefslogtreecommitdiff
path: root/webcam/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'webcam/views.py')
-rw-r--r--webcam/views.py22
1 files changed, 2 insertions, 20 deletions
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)