diff options
Diffstat (limited to 'webcam')
-rw-r--r-- | webcam/views.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/webcam/views.py b/webcam/views.py index 18f82f5..f6a1a81 100644 --- a/webcam/views.py +++ b/webcam/views.py @@ -5,10 +5,13 @@ from sbhs_server import settings from django.http import HttpResponse from myadmin.views import checkadmin from sbhs_server.tables.models import Board -# Create your views here. -# + 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) @@ -22,12 +25,21 @@ def load_image(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) return HttpResponse("") @login_required(redirect_field_name=None) def show_video(req): + """ Shows the video of the SBHS. + + Input: req:request object. + Output: HttpResponse object. + """ board = req.user.board image_link = board.image_link() @@ -40,6 +52,11 @@ def show_video(req): @login_required(redirect_field_name=None) def show_video_to_admin(req, mid): + """ Shows the video of the SBHS to the admin. + + Input: req:request object. + Output: HttpResponse object. + """ checkadmin(req) board = Board.objects.get(mid=int(mid)) image_link = board.image_link() |