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:
@@ -0,0 +1,52 @@
|
||||
export enum QuerySource {
|
||||
// Camera queries are handled by CameraManager.
|
||||
Camera = 'camera',
|
||||
|
||||
// Folder queries are handled by FolderManager.
|
||||
Folder = 'folder',
|
||||
}
|
||||
|
||||
export interface BaseQuery {
|
||||
source: QuerySource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter properties that can be applied to queries.
|
||||
* Not all query types support all filters -- engines reject unsupported ones.
|
||||
*/
|
||||
export interface QueryFilters {
|
||||
favorite?: boolean;
|
||||
tags?: Set<string>;
|
||||
what?: Set<string>;
|
||||
where?: Set<string>;
|
||||
reviewed?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares which filters a query handler supports.
|
||||
* Used by hasUnsupportedFilters() to check compatibility.
|
||||
*/
|
||||
interface SupportedFilters {
|
||||
favorite?: boolean;
|
||||
tags?: boolean;
|
||||
what?: boolean;
|
||||
where?: boolean;
|
||||
reviewed?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a query has filters that aren't supported.
|
||||
* Returns true if the query has any filter that isn't in the supported set.
|
||||
*/
|
||||
export const hasUnsupportedFilters = (
|
||||
query: QueryFilters,
|
||||
supported: SupportedFilters = {},
|
||||
): boolean => {
|
||||
return (
|
||||
(!supported.favorite && query.favorite !== undefined) ||
|
||||
(!supported.tags && !!query.tags?.size) ||
|
||||
(!supported.what && !!query.what?.size) ||
|
||||
(!supported.where && !!query.where?.size) ||
|
||||
(!supported.reviewed && query.reviewed !== undefined)
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user