b2b1804f5ef26841afe438d752c9d601c7468769,homeassistant/components/camera/__init__.py,Camera,mjpeg_stream,#Camera#Any#,89
Before Change
def mjpeg_stream(self, response):
Generate an HTTP MJPEG stream from camera images.
import eventlet
response.content_type = ("multipart/x-mixed-replace; "
"boundary=--jpegboundary")
def stream():
Stream images as mjpeg stream.
try:
last_image = None
while True:
img_bytes = self.camera_image()
if img_bytes is not None and img_bytes != last_image:
yield bytes(
"--jpegboundary\r\n"
"Content-Type: image/jpeg\r\n"
"Content-Length: {}\r\n\r\n".format(
len(img_bytes)), "utf-8") + img_bytes + b"\r\n"
last_image = img_bytes
eventlet.sleep(0.5)
except GeneratorExit:
pass
response.response = stream()
return response
@property
def state(self):
Camera state.
After Change
except GeneratorExit:
pass
return response(
stream(),
content_type=("multipart/x-mixed-replace; "
"boundary=--jpegboundary")
)
@property
def state(self):
Camera state.
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 8
Instances
Project Name: home-assistant/home-assistant
Commit Name: b2b1804f5ef26841afe438d752c9d601c7468769
Time: 2016-06-12
Author: st.john.johnson@gmail.com
File Name: homeassistant/components/camera/__init__.py
Class Name: Camera
Method Name: mjpeg_stream
Project Name: home-assistant/home-assistant
Commit Name: b2b1804f5ef26841afe438d752c9d601c7468769
Time: 2016-06-12
Author: st.john.johnson@gmail.com
File Name: homeassistant/components/camera/__init__.py
Class Name: Camera
Method Name: mjpeg_stream
Project Name: home-assistant/home-assistant
Commit Name: b2b1804f5ef26841afe438d752c9d601c7468769
Time: 2016-06-12
Author: st.john.johnson@gmail.com
File Name: homeassistant/components/camera/mjpeg.py
Class Name: MjpegCamera
Method Name: mjpeg_stream
Project Name: home-assistant/home-assistant
Commit Name: 3723c3a7e824bcfbda38f3e0788dc8b1dd2858a9
Time: 2016-06-11
Author: st.john.johnson@gmail.com
File Name: homeassistant/components/camera/mjpeg.py
Class Name: MjpegCamera
Method Name: mjpeg_stream
Project Name: home-assistant/home-assistant
Commit Name: 3723c3a7e824bcfbda38f3e0788dc8b1dd2858a9
Time: 2016-06-11
Author: st.john.johnson@gmail.com
File Name: homeassistant/components/camera/__init__.py
Class Name: Camera
Method Name: mjpeg_stream