Merge pull request #660 from dermotduffy/download-from-timeline

Fix downloads from the timeline
This commit is contained in:
Dermot Duffy
2022-06-10 17:15:30 -07:00
committed by GitHub
2 changed files with 13 additions and 2 deletions
+12 -2
View File
@@ -61,6 +61,8 @@ import {
FrigateCardView,
FRIGATE_CARD_VIEWS_USER_SPECIFIED,
MediaShowInfo,
MEDIA_TYPE_IMAGE,
MEDIA_TYPE_VIDEO,
MenuButton,
Message,
RawFrigateCardConfig
@@ -1127,7 +1129,11 @@ export class FrigateCard extends LitElement {
return;
}
if (!this._view.media) {
if (
!this._view.media ||
(this._view.media.media_content_type !== MEDIA_TYPE_VIDEO &&
this._view.media.media_content_type !== MEDIA_TYPE_IMAGE)
) {
this._setMessageAndUpdate({
message: localize('error.download_no_media'),
type: 'error',
@@ -1151,7 +1157,11 @@ export class FrigateCard extends LitElement {
const path =
`/api/frigate/${cameraConfig.frigate.client_id}` +
`/notifications/${event_id}/` +
`${this._view.isClipRelatedView() ? 'clip.mp4' : 'snapshot.jpg'}` +
`${
this._view.media.media_content_type === MEDIA_TYPE_VIDEO
? 'clip.mp4'
: 'snapshot.jpg'
}` +
`?download=true`;
let response: string | null | undefined;
try {
+1
View File
@@ -1233,6 +1233,7 @@ export interface CardHelpers {
export const MEDIA_CLASS_PLAYLIST = 'playlist' as const;
export const MEDIA_CLASS_VIDEO = 'video' as const;
export const MEDIA_TYPE_PLAYLIST = 'playlist' as const;
export const MEDIA_TYPE_IMAGE = 'image' as const;
export const MEDIA_TYPE_VIDEO = 'video' as const;
// Recursive type, cannot use type interference: