diff options
author | CruiseDevice | 2018-11-01 17:35:00 +0530 |
---|---|---|
committer | CruiseDevice | 2018-11-01 17:35:00 +0530 |
commit | 4050ec641b8cc4fef8d8a757c27bde0802b5c3e9 (patch) | |
tree | 68698c8b3da1a0b2a4a6540f667792192601e802 /sbhs/models.py | |
parent | 0bb3e3efd22a5a0f48c88720f6142bc3f49bc349 (diff) | |
download | sbhs_server-4050ec641b8cc4fef8d8a757c27bde0802b5c3e9.tar.gz sbhs_server-4050ec641b8cc4fef8d8a757c27bde0802b5c3e9.tar.bz2 sbhs_server-4050ec641b8cc4fef8d8a757c27bde0802b5c3e9.zip |
Update documentation in README and Add webcam features in SBHS
- Admin can view all SBHS live feeds.
- User can view their allocated live feed.
- Request machine change modal fix in base.html.
Diffstat (limited to 'sbhs/models.py')
-rw-r--r-- | sbhs/models.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sbhs/models.py b/sbhs/models.py index 2cdbb90..506ba14 100644 --- a/sbhs/models.py +++ b/sbhs/models.py @@ -66,6 +66,13 @@ class Board(models.Model): self.userboard_set.all().count() ) + def image_link(self): + """ + Function to show the image obtained from webcam + """ + return settings.WEBCAM_STATIC_DIR + "image" + '0' + str(self.mid) \ + + ".jpeg" + class Profile(models.Model): """ Profile model to store user details. @@ -167,12 +174,11 @@ class UserBoard(models.Model): def __str__(self): return '{0}: {1}'.format(self.user.username, self.board.mid) -class Webcam(): - - def __init__(self): - pass +class Webcam(object): - def load_image(className,mid): + @staticmethod + def load_image(mid): command = "timeout 2s streamer -q -f jpeg -c /dev/video" + '0'+str(mid) - command += " -o " + settings.WEBCAM_DIR + "image" + '0'+str(mid) + ".jpeg" + command += " -o " + settings.WEBCAM_DIR + "image" + '0'+str(mid) \ + + ".jpeg" os.system(command)
\ No newline at end of file |