- Add support for Frigate reviews / detections. - Add support for GenAI metadata. - Significant internal refactor to more flexible "UnifiedQuery" to allow mixing cameras with simple metadata and review metadata (e.g. a timeline view of a Frigate camera with reviews, and a Reolink camera with simple metadata). - Add support for folder media as camera media. There are a few more PRs to commit prior to this going live, but commiting this for now due to the scale of the change. BREAKING CHANGE: `media_type` and `events_type` are retired under `live`, `viewer` and `timeline` configuration sections, instead media type is associated (once) with the camera under `media`.
80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
FrigateEventViewMedia,
|
|
FrigateReviewViewMedia,
|
|
} from '../../../src/camera-manager/frigate/media';
|
|
import { ViewMediaType } from '../../../src/view/item';
|
|
import { createFrigateEvent, createFrigateReview } from '../../test-utils';
|
|
|
|
describe('FrigateReviewViewMedia', () => {
|
|
it('should get description when scene is present', () => {
|
|
const review = createFrigateReview({
|
|
data: {
|
|
objects: [],
|
|
zones: [],
|
|
metadata: {
|
|
scene: 'A person walking',
|
|
title: 'Title',
|
|
},
|
|
},
|
|
});
|
|
const media = new FrigateReviewViewMedia(
|
|
'camera',
|
|
review,
|
|
'content_id',
|
|
'thumbnail',
|
|
);
|
|
expect(media.getDescription()).toBe('A person walking');
|
|
});
|
|
|
|
it('should get null description when scene is absent', () => {
|
|
const review = createFrigateReview({
|
|
data: {
|
|
objects: [],
|
|
zones: [],
|
|
metadata: {
|
|
title: 'Title',
|
|
// scene is absent.
|
|
},
|
|
},
|
|
});
|
|
const media = new FrigateReviewViewMedia(
|
|
'camera',
|
|
review,
|
|
'content_id',
|
|
'thumbnail',
|
|
);
|
|
expect(media.getDescription()).toBeNull();
|
|
});
|
|
});
|
|
|
|
describe('FrigateEventViewMedia', () => {
|
|
it('should get description when description is present', () => {
|
|
const event = createFrigateEvent({
|
|
data: {
|
|
description: 'A person walking',
|
|
},
|
|
});
|
|
const media = new FrigateEventViewMedia(
|
|
ViewMediaType.Clip,
|
|
'camera',
|
|
event,
|
|
'content_id',
|
|
'thumbnail',
|
|
);
|
|
expect(media.getDescription()).toBe('A person walking');
|
|
});
|
|
|
|
it('should get null description when data is absent', () => {
|
|
const event = createFrigateEvent();
|
|
const media = new FrigateEventViewMedia(
|
|
ViewMediaType.Clip,
|
|
'camera',
|
|
event,
|
|
'content_id',
|
|
'thumbnail',
|
|
);
|
|
expect(media.getDescription()).toBeNull();
|
|
});
|
|
});
|