mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2025-12-11 20:15:30 +01:00
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:
parent
2f6c8a985d
commit
85012ac165
@ -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 {
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
|
||||
@ -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) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user