feat: Add support for Frigate reviews / detections [initial PR] (#2315)

- 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`.
This commit is contained in:
Dermot Duffy
2026-01-19 13:32:50 -08:00
committed by GitHub
parent 6eb0a87ca8
commit fc32727860
215 changed files with 14491 additions and 6160 deletions
+16 -12
View File
@@ -1,11 +1,11 @@
import { describe, expect, it } from 'vitest';
import { EventMediaQuery } from '../../src/view/query';
import { UnifiedQuery } from '../../src/view/unified-query';
import { QueryResults } from '../../src/view/query-results';
import { createView } from '../test-utils';
describe('View Basics', () => {
it('should construct from parameters', () => {
const query = new EventMediaQuery();
const query = new UnifiedQuery();
const queryResults = new QueryResults();
const context = {};
@@ -29,7 +29,7 @@ describe('View Basics', () => {
const view = createView({
view: 'live',
camera: 'camera',
query: new EventMediaQuery(),
query: new UnifiedQuery(),
queryResults: new QueryResults(),
context: {},
});
@@ -52,7 +52,7 @@ describe('View Basics', () => {
const view = createView({
view: 'live',
camera: 'camera-1',
query: new EventMediaQuery(),
query: new UnifiedQuery(),
queryResults: new QueryResults(),
context: {},
displayMode: 'single',
@@ -61,7 +61,7 @@ describe('View Basics', () => {
const evolved = view.evolve({
view: 'clips',
camera: 'camera-2',
query: new EventMediaQuery(),
query: new UnifiedQuery(),
queryResults: new QueryResults(),
context: {},
displayMode: 'grid',
@@ -78,7 +78,7 @@ describe('View Basics', () => {
const view = createView({
view: 'live',
camera: 'camera-1',
query: new EventMediaQuery(),
query: new UnifiedQuery(),
queryResults: new QueryResults(),
context: {},
});
@@ -184,15 +184,16 @@ describe('View Basics', () => {
describe('should detect gallery views', () => {
it('should detect gallery views', () => {
expect(createView({ view: 'clips' }).isMediaGalleryView()).toBeTruthy();
expect(createView({ view: 'folders' }).isMediaGalleryView()).toBeTruthy();
expect(createView({ view: 'snapshots' }).isMediaGalleryView()).toBeTruthy();
expect(createView({ view: 'recordings' }).isMediaGalleryView()).toBeTruthy();
expect(createView({ view: 'clips' }).isGalleryView()).toBeTruthy();
expect(createView({ view: 'folders' }).isGalleryView()).toBeTruthy();
expect(createView({ view: 'snapshots' }).isGalleryView()).toBeTruthy();
expect(createView({ view: 'recordings' }).isGalleryView()).toBeTruthy();
expect(createView({ view: 'reviews' }).isGalleryView()).toBeTruthy();
});
it('should not detect gallery view', () => {
expect(createView({ view: 'live' }).isMediaGalleryView()).toBeFalsy();
expect(createView({ view: 'timeline' }).isMediaGalleryView()).toBeFalsy();
expect(createView({ view: 'live' }).isGalleryView()).toBeFalsy();
expect(createView({ view: 'timeline' }).isGalleryView()).toBeFalsy();
});
});
@@ -202,6 +203,7 @@ describe('View Basics', () => {
expect(createView({ view: 'snapshot' }).isViewerView()).toBeTruthy();
expect(createView({ view: 'media' }).isViewerView()).toBeTruthy();
expect(createView({ view: 'recording' }).isViewerView()).toBeTruthy();
expect(createView({ view: 'review' }).isViewerView()).toBeTruthy();
expect(createView({ view: 'folder' }).isAnyMediaView()).toBeTruthy();
});
@@ -222,6 +224,8 @@ describe('View Basics', () => {
expect(createView({ view: 'recordings' }).getDefaultMediaType()).toBe(
'recordings',
);
expect(createView({ view: 'review' }).getDefaultMediaType()).toBe('reviews');
expect(createView({ view: 'reviews' }).getDefaultMediaType()).toBe('reviews');
});
it('should not get default media type', () => {