diff options
author | sriyasainath | 2017-06-23 00:37:58 +0530 |
---|---|---|
committer | sriyasainath | 2017-06-23 00:37:58 +0530 |
commit | 470fc4aa20fc68fd0d3ef5c94768a39f3623765c (patch) | |
tree | 47be7cbdd5574a0444d6615fa739aa6f821d73c0 /webcam | |
parent | 3f8f040616c65b26e256a7fa404ce74520722c56 (diff) | |
download | SBHS-2018-Rpi-470fc4aa20fc68fd0d3ef5c94768a39f3623765c.tar.gz SBHS-2018-Rpi-470fc4aa20fc68fd0d3ef5c94768a39f3623765c.tar.bz2 SBHS-2018-Rpi-470fc4aa20fc68fd0d3ef5c94768a39f3623765c.zip |
Add docstrings for the project.
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() |