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:
+16
-13
@@ -2,8 +2,9 @@ import { merge } from 'lodash-es';
|
||||
import { ViewContext } from 'view';
|
||||
import { AdvancedCameraCardView } from '../config/schema/common/const';
|
||||
import { ViewDisplayMode } from '../config/schema/common/display';
|
||||
import { Query } from './query';
|
||||
import { ViewMediaType } from '../types';
|
||||
import { QueryResults } from './query-results';
|
||||
import { UnifiedQuery } from './unified-query';
|
||||
|
||||
declare module 'view' {
|
||||
interface ViewContext {
|
||||
@@ -16,7 +17,7 @@ declare module 'view' {
|
||||
interface ViewEvolveParameters {
|
||||
view?: AdvancedCameraCardView;
|
||||
camera?: string;
|
||||
query?: Query | null;
|
||||
query?: UnifiedQuery | null;
|
||||
queryResults?: QueryResults | null;
|
||||
context?: ViewContext | null;
|
||||
displayMode?: ViewDisplayMode | null;
|
||||
@@ -37,7 +38,7 @@ export const mergeViewContext = (
|
||||
export class View {
|
||||
public view: AdvancedCameraCardView;
|
||||
public camera: string;
|
||||
public query: Query | null;
|
||||
public query: UnifiedQuery | null;
|
||||
public queryResults: QueryResults | null;
|
||||
public context: ViewContext | null;
|
||||
public displayMode: ViewDisplayMode | null;
|
||||
@@ -123,10 +124,12 @@ export class View {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a view is a media gallery.
|
||||
* Determine if a view is a gallery.
|
||||
*/
|
||||
public isMediaGalleryView(): boolean {
|
||||
return ['clips', 'folders', 'snapshots', 'recordings'].includes(this.view);
|
||||
public isGalleryView(): boolean {
|
||||
return ['clips', 'folders', 'snapshots', 'recordings', 'reviews'].includes(
|
||||
this.view,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,19 +148,16 @@ export class View {
|
||||
* Determine if a view is for the media viewer.
|
||||
*/
|
||||
public isViewerView(): boolean {
|
||||
return ['folder', 'media', 'clip', 'snapshot', 'recording'].includes(this.view);
|
||||
return ['folder', 'media', 'clip', 'snapshot', 'recording', 'review'].includes(
|
||||
this.view,
|
||||
);
|
||||
}
|
||||
|
||||
public supportsMultipleDisplayModes(): boolean {
|
||||
return this.isViewerView() || this.is('live');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default media type for this view if available.
|
||||
* @returns Whether the default media is `clips`, `snapshots`, `recordings` or unknown
|
||||
* (`null`).
|
||||
*/
|
||||
public getDefaultMediaType(): 'clips' | 'snapshots' | 'recordings' | null {
|
||||
public getDefaultMediaType(): ViewMediaType | null {
|
||||
if (['clip', 'clips'].includes(this.view)) {
|
||||
return 'clips';
|
||||
}
|
||||
@@ -167,6 +167,9 @@ export class View {
|
||||
if (['recording', 'recordings'].includes(this.view)) {
|
||||
return 'recordings';
|
||||
}
|
||||
if (['review', 'reviews'].includes(this.view)) {
|
||||
return 'reviews';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user