15e329a5882db608e49f26eded5014645efbac66,homeassistant/components/camera/__init__.py,,setup,#Any#Any#,42
Before Change
handler.send_response(HTTP_OK)
handler.write_content(response)
hass.http.register_path(
"GET",
re.compile(r"/api/camera_proxy/(?P<entity_id>[a-zA-Z\._0-9]+)"),
_proxy_camera_image)
def _proxy_camera_mjpeg_stream(handler, path_match, data):
Proxy the camera image as an mjpeg stream via the HA server.
entity_id = path_match.group(ATTR_ENTITY_ID)
camera = component.entities.get(entity_id)
if camera is None:
handler.send_response(HTTP_NOT_FOUND)
handler.end_headers()
return
try:
camera.is_streaming = True
camera.update_ha_state()
camera.mjpeg_stream(handler)
except (requests.RequestException, IOError):
camera.is_streaming = False
camera.update_ha_state()
hass.http.register_path(
"GET",
re.compile(r"/api/camera_proxy_stream/(?P<entity_id>[a-zA-Z\._0-9]+)"),
_proxy_camera_mjpeg_stream)
return True
After Change
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL,
DISCOVERY_PLATFORMS)
hass.wsgi.register_view(CameraImageView(hass, component.entities))
hass.wsgi.register_view(CameraMjpegStream(hass, component.entities))
component.setup(config)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: home-assistant/home-assistant
Commit Name: 15e329a5882db608e49f26eded5014645efbac66
Time: 2016-05-21
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/camera/__init__.py
Class Name:
Method Name: setup
Project Name: home-assistant/home-assistant
Commit Name: 15e329a5882db608e49f26eded5014645efbac66
Time: 2016-05-21
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/history.py
Class Name:
Method Name: setup
Project Name: home-assistant/home-assistant
Commit Name: 15e329a5882db608e49f26eded5014645efbac66
Time: 2016-05-21
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/camera/__init__.py
Class Name:
Method Name: setup
Project Name: home-assistant/home-assistant
Commit Name: 15e329a5882db608e49f26eded5014645efbac66
Time: 2016-05-21
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/sensor/fitbit.py
Class Name:
Method Name: setup_platform