feat: add proxy generation policy to job configurations

- Introduced a new ProxyPolicy struct to manage video scrubbing settings, including options for enabling and regenerating proxy files.
- Updated JobPolicies to include the new proxy policy with default values.
- Enhanced FileInspector to filter batch events by resource ID for improved event handling.
- Modified useNormalizedCache to skip path validation checks when resourceId is provided, optimizing resource handling.
This commit is contained in:
Jamie Pine 2025-11-18 05:48:23 -08:00
parent 2f6c8a985d
commit 85012ac165
3 changed files with 28 additions and 1 deletions

View File

@ -266,6 +266,10 @@ pub struct JobPolicies {
#[serde(default)]
pub thumbstrip: ThumbstripPolicy,
/// Proxy/sidecar generation policy (video scrubbing)
#[serde(default)]
pub proxy: ProxyPolicy,
/// OCR (text extraction) policy
#[serde(default)]
pub ocr: OcrPolicy,
@ -284,6 +288,7 @@ impl Default for JobPolicies {
Self {
thumbnail: ThumbnailPolicy::default(),
thumbstrip: ThumbstripPolicy::default(),
proxy: ProxyPolicy::default(),
ocr: OcrPolicy::default(),
speech_to_text: SpeechPolicy::default(),
object_detection: ObjectDetectionPolicy::default(),
@ -373,6 +378,25 @@ impl ThumbstripPolicy {
}
}
/// Proxy/sidecar generation policy (video scrubbing)
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
pub struct ProxyPolicy {
/// Whether to generate proxy files for this location
pub enabled: bool,
/// Whether to regenerate existing proxies
pub regenerate: bool,
}
impl Default for ProxyPolicy {
fn default() -> Self {
Self {
enabled: false, // Disabled by default (expensive operation)
regenerate: false,
}
}
}
/// OCR (text extraction) policy
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
pub struct OcrPolicy {

View File

@ -50,6 +50,7 @@ export function FileInspector({ file }: FileInspectorProps) {
wireMethod: "query:files.by_id",
input: { file_id: file?.id || "" },
resourceType: "file",
resourceId: file?.id, // Filter batch events to only this file
enabled: !!file?.id,
});

View File

@ -632,10 +632,12 @@ export function useNormalizedCache<I, O>({
if (isSingleResource) {
// For File resources with sd_path, validate path matches (prevent cross-path pollution)
// Skip this check if resourceId is provided - we've already filtered to the exact file
const oldPath = (oldData as any).sd_path;
if (oldPath) {
if (oldPath && !resourceId) {
// This is a File with a path - filter to matching path only
// Only needed when resourceId is NOT provided (list queries)
const filteredByPath =
filteredResources.filter(
(resource: any) => {