Skip to content

Commit

Permalink
Merge pull request #687 from blakeblackshear/dev
Browse files Browse the repository at this point in the history
Merge dev into master for 5.3.0 release
  • Loading branch information
NickM-27 authored Jul 12, 2024
2 parents 5b9f4f7 + 5b2ecc9 commit 678c640
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/frigate/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/blakeblackshear/frigate-hass-integration/issues",
"requirements": ["pytz"],
"version": "5.2.0"
"version": "5.3.0"
}
7 changes: 7 additions & 0 deletions custom_components/frigate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ def _create_path(self, **kwargs: Any) -> str | None:

if path.endswith("clip.mp4"):
return f"api/events/{event_id}/clip.mp4"

if path.endswith("event_preview.gif"):
return f"api/events/{event_id}/preview.gif"

if path.endswith("review_preview.gif"):
return f"api/review/{event_id}/preview"

return None

def _permit_request(
Expand Down
30 changes: 30 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ async def handler(request: web.Request) -> web.Response:
web.get("/api/events/event_id/thumbnail.jpg", handler),
web.get("/api/events/event_id/snapshot.jpg", handler),
web.get("/api/events/event_id/clip.mp4", handler),
web.get("/api/events/event_id/preview.gif", handler),
web.get("/api/review/event_id/preview", handler),
web.get("/api/events/1577854800.123456-random/snapshot.jpg", handler),
web.get("/api/events/1635807600.123456-random/snapshot.jpg", handler),
web.get("/api/events/1635807359.123456-random/snapshot.jpg", handler),
Expand Down Expand Up @@ -364,6 +366,34 @@ async def test_notifications_proxy_view_snapshot(
assert resp.status == HTTPStatus.OK


async def test_notifications_proxy_view_event_preview(
local_frigate: Any,
hass_client_no_auth: Any,
) -> None:
"""Test notification clip."""

unauthenticated_hass_client = await hass_client_no_auth()

resp = await unauthenticated_hass_client.get(
"/api/frigate/notifications/event_id/event_preview.gif"
)
assert resp.status == HTTPStatus.OK


async def test_notifications_proxy_view_review_preview(
local_frigate: Any,
hass_client_no_auth: Any,
) -> None:
"""Test notification clip."""

unauthenticated_hass_client = await hass_client_no_auth()

resp = await unauthenticated_hass_client.get(
"/api/frigate/notifications/event_id/review_preview.gif"
)
assert resp.status == HTTPStatus.OK


async def test_notifications_proxy_view_clip(
local_frigate: Any,
hass_client_no_auth: Any,
Expand Down

0 comments on commit 678c640

Please sign in to comment.