Add ability to download recordings.
This commit is contained in:
+24
-8
@@ -1030,8 +1030,9 @@ export class FrigateCard extends LitElement {
|
||||
|
||||
if (this._cameras && (changedProps.has('_config') || changedProps.has('_cameras'))) {
|
||||
this._timelineDataManager = new TimelineDataManager(
|
||||
this._cameras, this._config.timeline.media
|
||||
)
|
||||
this._cameras,
|
||||
this._config.timeline.media,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1226,6 +1227,14 @@ export class FrigateCard extends LitElement {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const cameraConfig = this._getSelectedCameraConfig();
|
||||
if (!cameraConfig || !cameraConfig.frigate.camera_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
let path: string;
|
||||
if (this._view.media.frigate?.event) {
|
||||
const event_id = getEventID(this._view.media);
|
||||
if (!event_id) {
|
||||
this._setMessageAndUpdate({
|
||||
@@ -1235,12 +1244,7 @@ export class FrigateCard extends LitElement {
|
||||
return;
|
||||
}
|
||||
|
||||
const cameraConfig = this._getSelectedCameraConfig();
|
||||
if (!cameraConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
const path =
|
||||
path =
|
||||
`/api/frigate/${cameraConfig.frigate.client_id}` +
|
||||
`/notifications/${event_id}/` +
|
||||
`${
|
||||
@@ -1249,6 +1253,18 @@ export class FrigateCard extends LitElement {
|
||||
: 'snapshot.jpg'
|
||||
}` +
|
||||
`?download=true`;
|
||||
} else if (this._view.media.frigate?.recording) {
|
||||
const recording = this._view.media.frigate.recording;
|
||||
path =
|
||||
`/api/frigate/${cameraConfig.frigate.client_id}` +
|
||||
`/recording/${cameraConfig.frigate.camera_name}` +
|
||||
`/start/${recording.start_time}` +
|
||||
`/end/${recording.end_time}` +
|
||||
`?download=true`;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
let response: string | null | undefined;
|
||||
try {
|
||||
response = await homeAssistantSignPath(this._hass, path);
|
||||
|
||||
Reference in New Issue
Block a user