Dynamically extract dimensions from loaded media.

This commit is contained in:
Dermot Duffy
2021-09-23 20:38:39 -07:00
parent c75e99e09c
commit e3ccbb0787
13 changed files with 312 additions and 44 deletions
+15 -1
View File
@@ -97,6 +97,15 @@ export const frigateCardConfigSchema = z.object({
nextprev: z.enum(NEXT_PREVIOUS_CONTROL_STYLES).default('thumbnails'),
})
.optional(),
dimensions: z.object({
aspect_ratio_mode: z.enum(['dynamic', 'static']).default('dynamic'),
aspect_ratio:
z.number().array().length(2).or(
z.string()
.regex(/^\s*\d+\s*\/\s*\d+\s*$/)
.transform((input) => input.split("/").map((d) => Number(d)))
).default([16, 9]),
}).optional(),
// Stock lovelace card config.
type: z.string(),
@@ -126,8 +135,13 @@ export interface BrowseMediaQueryParameters {
after?: number;
}
export interface MediaLoadInfo {
width: number;
height: number;
}
/**
* Media Browser API types.
* Home Assistant API types.
*/
// Recursive type, cannot use type interference: