Merge pull request #660 from dermotduffy/download-from-timeline
Fix downloads from the timeline
This commit is contained in:
+12
-2
@@ -61,6 +61,8 @@ import {
|
|||||||
FrigateCardView,
|
FrigateCardView,
|
||||||
FRIGATE_CARD_VIEWS_USER_SPECIFIED,
|
FRIGATE_CARD_VIEWS_USER_SPECIFIED,
|
||||||
MediaShowInfo,
|
MediaShowInfo,
|
||||||
|
MEDIA_TYPE_IMAGE,
|
||||||
|
MEDIA_TYPE_VIDEO,
|
||||||
MenuButton,
|
MenuButton,
|
||||||
Message,
|
Message,
|
||||||
RawFrigateCardConfig
|
RawFrigateCardConfig
|
||||||
@@ -1127,7 +1129,11 @@ export class FrigateCard extends LitElement {
|
|||||||
return;
|
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({
|
this._setMessageAndUpdate({
|
||||||
message: localize('error.download_no_media'),
|
message: localize('error.download_no_media'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -1151,7 +1157,11 @@ export class FrigateCard extends LitElement {
|
|||||||
const path =
|
const path =
|
||||||
`/api/frigate/${cameraConfig.frigate.client_id}` +
|
`/api/frigate/${cameraConfig.frigate.client_id}` +
|
||||||
`/notifications/${event_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`;
|
`?download=true`;
|
||||||
let response: string | null | undefined;
|
let response: string | null | undefined;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1233,6 +1233,7 @@ export interface CardHelpers {
|
|||||||
export const MEDIA_CLASS_PLAYLIST = 'playlist' as const;
|
export const MEDIA_CLASS_PLAYLIST = 'playlist' as const;
|
||||||
export const MEDIA_CLASS_VIDEO = 'video' as const;
|
export const MEDIA_CLASS_VIDEO = 'video' as const;
|
||||||
export const MEDIA_TYPE_PLAYLIST = 'playlist' 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;
|
export const MEDIA_TYPE_VIDEO = 'video' as const;
|
||||||
|
|
||||||
// Recursive type, cannot use type interference:
|
// Recursive type, cannot use type interference:
|
||||||
|
|||||||
Reference in New Issue
Block a user