Exemplo n.º 1
0
"""DjangoWebcamStreaming URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.http import StreamingHttpResponse
from django.urls import path
from . import views

from camera import VideoCamera, gen

urlpatterns = [
    path("", views.index),
    path('monitor/', lambda r: StreamingHttpResponse(gen(VideoCamera()),
                                                     content_type='multipart/x-mixed-replace; boundary=frame'), name = "monitor"),
    path('admin/', admin.site.urls),
]
def monitor(request):
    global camera1
    return StreamingHttpResponse(
        gen(camera1), content_type='multipart/x-mixed-replace; boundary=frame')
Exemplo n.º 3
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from scan import camera
from django.contrib import admin
from django.urls import path
from scan import views as v
from django.http import StreamingHttpResponse
from camera import gen, VideoCamera

urlpatterns = [
    path('admin/', admin.site.urls),
    path('scan/', v.scan, name="scan"),
    path('home/', v.home),
    path(
        'monitor/', lambda r: StreamingHttpResponse(
            gen(VideoCamera()),
            content_type='multipart/x-mixed-replace; boundary=frame')),
]
Exemplo n.º 4
0
"""DjangoWebcamStreaming URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.conf import settings
from django.conf.urls import include, url
from django.http import StreamingHttpResponse
from django.urls import path

from camera import BusCam, gen

urlpatterns = [
    path(
        'monitor/', lambda r: StreamingHttpResponse(
            gen(BusCam()),
            content_type='multipart/x-mixed-replace; boundary=framesn')),
    path('', admin.site.urls),
]
Exemplo n.º 5
0
def video_feed():
    return Response(camera.gen(camera.VideoCamera()),
                    mimetype='multipart/x-mixed-replace; boundary=frame')
Exemplo n.º 6
0
def video_feed(cam_no):
    if not session.get('logged_in'):
        return "Login to view feed"
    return Response(camera.gen(cam_no),\
                    mimetype='multipart/x-mixed-replace; boundary=frame;')