Initial mini-timeline commit.
This commit is contained in:
+47
-30
@@ -38,6 +38,7 @@ export const FRIGATE_CARD_VIEWS_USER_SPECIFIED = [
|
||||
|
||||
const FRIGATE_CARD_VIEWS = [
|
||||
...FRIGATE_CARD_VIEWS_USER_SPECIFIED,
|
||||
'recording',
|
||||
|
||||
// Media: A generic piece of media (could be clip, snapshot, recording).
|
||||
'media',
|
||||
@@ -655,6 +656,45 @@ const thumbnailsControlSchema = z.object({
|
||||
});
|
||||
export type ThumbnailsControlConfig = z.infer<typeof thumbnailsControlSchema>;
|
||||
|
||||
/**
|
||||
* Core/Mini timeline controls configuration section.
|
||||
*/
|
||||
|
||||
const timelineCoreConfigDefault = {
|
||||
clustering_threshold: 3,
|
||||
media: 'all' as const,
|
||||
window_seconds: 60 * 60,
|
||||
show_recordings: true,
|
||||
};
|
||||
|
||||
const timelineCoreConfigSchema = z
|
||||
.object({
|
||||
clustering_threshold: z
|
||||
.number()
|
||||
.optional()
|
||||
.default(timelineCoreConfigDefault.clustering_threshold),
|
||||
media: z
|
||||
.enum(['all', 'clips', 'snapshots'])
|
||||
.optional()
|
||||
.default(timelineCoreConfigDefault.media),
|
||||
window_seconds: z
|
||||
.number()
|
||||
.min(1 * 60)
|
||||
.max(24 * 60 * 60)
|
||||
.optional()
|
||||
.default(timelineCoreConfigDefault.window_seconds),
|
||||
show_recordings: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.default(timelineCoreConfigDefault.show_recordings),
|
||||
});
|
||||
export type TimelineCoreConfig = z.infer<typeof timelineCoreConfigSchema>;
|
||||
|
||||
const miniTimelineConfigSchema = timelineCoreConfigSchema.extend({
|
||||
mode: z.enum(['none', 'above', 'below']),
|
||||
});
|
||||
export type MiniTimelineControlConfig = z.infer<typeof miniTimelineConfigSchema>;
|
||||
|
||||
/**
|
||||
* Next/Previous Control configuration section.
|
||||
*/
|
||||
@@ -787,6 +827,7 @@ const liveOverridableConfigSchema = z
|
||||
.default(liveConfigDefault.controls.thumbnails.media),
|
||||
})
|
||||
.default(liveConfigDefault.controls.thumbnails),
|
||||
timeline: miniTimelineConfigSchema.optional(),
|
||||
title: titleControlConfigSchema
|
||||
.extend({
|
||||
mode: titleControlConfigSchema.shape.mode.default(
|
||||
@@ -989,6 +1030,7 @@ const viewerConfigSchema = z
|
||||
),
|
||||
})
|
||||
.default(viewerConfigDefault.controls.thumbnails),
|
||||
timeline: miniTimelineConfigSchema.optional(),
|
||||
title: titleControlConfigSchema
|
||||
.extend({
|
||||
mode: titleControlConfigSchema.shape.mode.default(
|
||||
@@ -1082,10 +1124,7 @@ const dimensionsConfigSchema = z
|
||||
* Timeline configuration section.
|
||||
*/
|
||||
const timelineConfigDefault = {
|
||||
clustering_threshold: 3,
|
||||
media: 'all' as const,
|
||||
window_seconds: 60 * 60,
|
||||
show_recordings: true,
|
||||
...timelineCoreConfigDefault,
|
||||
controls: {
|
||||
thumbnails: {
|
||||
mode: 'left' as const,
|
||||
@@ -1096,26 +1135,8 @@ const timelineConfigDefault = {
|
||||
},
|
||||
},
|
||||
};
|
||||
const timelineConfigSchema = z
|
||||
.object({
|
||||
clustering_threshold: z
|
||||
.number()
|
||||
.optional()
|
||||
.default(timelineConfigDefault.clustering_threshold),
|
||||
media: z
|
||||
.enum(['all', 'clips', 'snapshots'])
|
||||
.optional()
|
||||
.default(timelineConfigDefault.media),
|
||||
window_seconds: z
|
||||
.number()
|
||||
.min(1 * 60)
|
||||
.max(24 * 60 * 60)
|
||||
.optional()
|
||||
.default(timelineConfigDefault.window_seconds),
|
||||
show_recordings: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.default(timelineConfigDefault.show_recordings),
|
||||
|
||||
const timelineConfigSchema = timelineCoreConfigSchema.extend({
|
||||
controls: z
|
||||
.object({
|
||||
thumbnails: thumbnailsControlSchema
|
||||
@@ -1362,16 +1383,11 @@ export interface FrigateEvent {
|
||||
}
|
||||
|
||||
export interface FrigateRecording {
|
||||
// Frigate camera name (may not be unique)
|
||||
camera: string;
|
||||
start_time: number;
|
||||
end_time: number;
|
||||
events: number;
|
||||
|
||||
// Specifies the point at which this recording should be played, the
|
||||
// seek_time is the date of the desired play point, and seek_seconds is the
|
||||
// number of seconds to seek to reach that point.
|
||||
seek_time?: number;
|
||||
seek_seconds?: number;
|
||||
}
|
||||
|
||||
export interface FrigateBrowseMediaSource extends BrowseMediaSource {
|
||||
@@ -1379,6 +1395,7 @@ export interface FrigateBrowseMediaSource extends BrowseMediaSource {
|
||||
frigate?: {
|
||||
event?: FrigateEvent;
|
||||
recording?: FrigateRecording;
|
||||
cameraID?: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user