Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

add external data through ui (#1164)

Louis Beaumont616753e76a0f
diff --git a/pipes/search/bun.lockb b/pipes/search/bun.lockb
index 4d9d0181b..b98b19251 100755
Binary files a/pipes/search/bun.lockb and b/pipes/search/bun.lockb differ
diff --git a/pipes/search/package.json b/pipes/search/package.json
index 770e74e37..6660425a8 100644
--- a/pipes/search/package.json
+++ b/pipes/search/package.json
@@ -22,7 +22,7 @@
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-toast": "^1.2.3",
"@radix-ui/react-tooltip": "^1.1.5",
- "@screenpipe/browser": "^0.1.17",
+ "@screenpipe/browser": "^0.1.18-beta.0",
"@screenpipe/js": "^1.0.6",
"@shadcn/ui": "^0.0.4",
"@tanstack/react-query": "^5.62.7",
diff --git a/pipes/search/src/components/search-chat.tsx b/pipes/search/src/components/search-chat.tsx
index 99c615cfe..3c9de2a6c 100644
--- a/pipes/search/src/components/search-chat.tsx
+++ b/pipes/search/src/components/search-chat.tsx
@@ -299,6 +299,8 @@ export function SearchChat() {
const [speakerSearchQuery, setSpeakerSearchQuery] = useState("");
+ const [frameName, setFrameName] = useState<string>("");
+
useEffect(() => {
if (Object.keys(selectedSpeakers).length > 0) {
setSelectedTypes({
@@ -769,6 +771,7 @@ export function SearchChat() {
speakerIds: Object.values(selectedSpeakers).map(
(speaker) => speaker.id
),
+ ...(frameName && { frame_name: frameName }),
};
const response = await pipe.queryScreenpipe(searchParams);
@@ -814,9 +817,10 @@ export function SearchChat() {
const handleBadgeClick = (value: string, type: "app" | "window") => {
if (type === "app") {
setAppName(value);
- } else {
+ } else if (type === "window") {
setWindowName(value);
}
+ handleSearch(0);
};
const handleSelectAll = (checked: boolean) => {
@@ -1393,14 +1397,6 @@ export function SearchChat() {
</DialogDescription>
</DialogHeader>
<div className="grid gap-4 py-4">
- {/* Remove the query section */}
- {/* <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="query" className="text-right">
- query
- </Label>
- ... query input ...
- </div> */}
-
{/* Keep other advanced search options */}
<div className="grid grid-cols-4 items-center gap-4">
<Label htmlFor="app-name" className="text-right">
@@ -1515,6 +1511,102 @@ export function SearchChat() {
</div>
</div>
</div>
+
+ <div className="grid grid-cols-4 items-center gap-4">
+ <Label htmlFor="speakers" className="text-right">
+ speakers
+ </Label>
+ <div className="col-span-3 flex items-center">
+ <Popover open={openSpeakers} onOpenChange={setOpenSpeakers}>
+ <PopoverTrigger asChild>
+ <Button
+ variant="outline"
+ role="combobox"
+ aria-expanded={openSpeakers}
+ className="w-full justify-between"
+ >
+ {Object.values(selectedSpeakers).length > 0
+ ? `${Object.values(selectedSpeakers)
+ .map((s) => s.name)
+ .join(", ")}`
+ : "select speakers"}
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-[350px] p-0">
+ <Command>
+ <CommandInput
+ placeholder="search speakers..."
+ value={speakerSearchQuery}
+ onValueChange={setSpeakerSearchQuery}
+ />
+ <CommandList>
+ <CommandEmpty>no speakers found.</CommandEmpty>
+ <CommandGroup>
+ {[...new Set(speakers)].map((speaker: Speaker) => (
+ <CommandItem
+ key={speaker.id}
+ value={speaker.name}
+ onSelect={() => handleSpeakerChange(speaker)}
+ >
+ <div className="flex items-center">
+ <Check
+ className={cn(
+ "mr-2 h-4 w-4",
+ selectedSpeakers[speaker.id]
+ ? "opacity-100"
+ : "opacity-0"
+ )}
+ />
+ <span
+ style={{
+ userSelect: "none",
+ WebkitUserSelect: "none",
+ MozUserSelect: "none",
+ msUserSelect: "none",
+ }}
+ >
+ {speaker.name}
+ </span>
+ </div>
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
+ </div>
+ </div>
+ {/* Add frame name input after app name */}
+ <div className="grid grid-cols-4 items-center gap-4">
+ <Label htmlFor="frame-name" className="text-right">
+ frame name
+ </Label>
+ <div className="col-span-3 flex items-center">
+ <Input
+ id="frame-name"
+ type="text"
+ value={frameName}
+ onChange={(e) => setFrameName(e.target.value)}
+ placeholder="filter by frame name"
+ className="flex-grow"
+ />
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>
+ filter results by specific frame names (by default frame
+ name is mp4 video file path)
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ </div>
<div className="flex items-center justify-center space-x-2">
<Switch
id="include-frames"
@@ -1537,85 +1629,6 @@ export function SearchChat() {
</Tooltip>
</TooltipProvider>
</div>
- <div className="flex items-center justify-center space-x-2">
- <Label htmlFor="speakers" className="flex items-center space-x-2">
- <SpeechIcon className="h-4 w-4" />
- <span>speakers</span>
- </Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- select the speakers to include in the search results. this
- will only show results from the selected speakers. note:
- only audio results can be returned
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <Popover open={openSpeakers} onOpenChange={setOpenSpeakers}>
- <PopoverTrigger asChild>
- <Button
- variant="outline"
- role="combobox"
- aria-expanded={openSpeakers}
- className="w-full justify-between"
- >
- {Object.values(selectedSpeakers).length > 0
- ? `${Object.values(selectedSpeakers)
- .map((s) => s.name)
- .join(", ")}`
- : "select speakers"}
- <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-full p-0">
- <Command>
- <CommandInput
- placeholder="search speakers..."
- value={speakerSearchQuery}
- onValueChange={setSpeakerSearchQuery}
- />
- <CommandList>
- <CommandEmpty>no speakers found.</CommandEmpty>
- <CommandGroup>
- {[...new Set(speakers)].map((speaker: Speaker) => (
- <CommandItem
- key={speaker.id}
- value={speaker.name}
- onSelect={() => handleSpeakerChange(speaker)}
- >
- <div className="flex items-center">
- <Check
- className={cn(
- "mr-2 h-4 w-4",
- selectedSpeakers[speaker.id]
- ? "opacity-100"
- : "opacity-0"
- )}
- />
- <span
- style={{
- userSelect: "none",
- WebkitUserSelect: "none",
- MozUserSelect: "none",
- msUserSelect: "none",
- }}
- >
- {speaker.name}
- </span>
- </div>
- </CommandItem>
- ))}
- </CommandGroup>
- </CommandList>
- </Command>
- </PopoverContent>
- </Popover>
- </div>
<DialogFooter>
<Button onClick={() => setIsQueryParamsDialogOpen(false)}>
done
diff --git a/screenpipe-app-tauri/components/settings.tsx b/screenpipe-app-tauri/components/settings.tsx
index b8dc3185e..7e160ec9e 100644
--- a/screenpipe-app-tauri/components/settings.tsx
+++ b/screenpipe-app-tauri/components/settings.tsx
@@ -11,7 +11,8 @@ import {
Plus,
Trash2,
Check,
- HardDrive
+ HardDrive,
+ FolderInput,
} from "lucide-react";
import { DialogHeader, DialogTitle } from "./ui/dialog";
import { cn } from "@/lib/utils";
@@ -33,8 +34,15 @@ import { relaunch } from "@tauri-apps/plugin-process";
import { invoke } from "@tauri-apps/api/core";
import { useProfiles } from "@/lib/hooks/use-profiles";
import { toast } from "./ui/use-toast";
+import { DataImportSection } from "./settings/data-import-section";
-type SettingsSection = "ai" | "shortcuts" | "recording" | "account" | "diskUsage";
+type SettingsSection =
+ | "ai"
+ | "shortcuts"
+ | "recording"
+ | "account"
+ | "diskUsage"
+ | "dataImport";
export function Settings() {
// const { settings, switchProfile, deleteProfile } = useSettings();
@@ -104,6 +112,8 @@ export function Settings() {
return <ShortcutSection />;
case "diskUsage":
return <DiskUsage />;
+ case "dataImport":
+ return <DataImportSection />;
}
};
@@ -221,6 +231,11 @@ export function Settings() {
label: "disk usage",
icon: <HardDrive className="h-4 w-4" />,
},
+ {
+ id: "dataImport",
+ label: "data import",
+ icon: <FolderInput className="h-4 w-4" />,
+ },
].map((section) => (
<button
key={section.id}
diff --git a/screenpipe-app-tauri/components/settings/data-import-section.tsx b/screenpipe-app-tauri/components/settings/data-import-section.tsx
new file mode 100644
index 000000000..55d02cea4
--- /dev/null
+++ b/screenpipe-app-tauri/components/settings/data-import-section.tsx
@@ -0,0 +1,382 @@
+import React, { useState, useEffect } from "react";
+import { Command, Trash2, Plus } from "lucide-react";
+import { Button } from "../ui/button";
+import { Input } from "../ui/input";
+import { Command as TauriCommand } from "@tauri-apps/plugin-shell";
+import { toast } from "../ui/use-toast";
+import { open } from "@tauri-apps/plugin-dialog";
+import { FolderOpen } from "lucide-react";
+import { Card, CardContent } from "../ui/card";
+import { Label } from "../ui/label";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "../ui/accordion";
+import { writeTextFile, BaseDirectory, readDir } from "@tauri-apps/plugin-fs";
+import { join } from "@tauri-apps/api/path";
+import { appLocalDataDir } from "@tauri-apps/api/path";
+
+interface VideoMetadata {
+ file_path: string;
+ metadata: {
+ name?: string;
+ creation_time?: string;
+ fps?: number;
+ device_name?: string;
+ };
+}
+
+export function DataImportSection() {
+ const [path, setPath] = useState("");
+ const [isIndexing, setIsIndexing] = useState(false);
+ const [detectedVideos, setDetectedVideos] = useState<string[]>([]);
+ const [metadataConfig, setMetadataConfig] = useState<VideoMetadata[]>([]);
+ const [isScanning, setIsScanning] = useState(false);
+ const [progress, setProgress] = useState<{
+ current: number;
+ total: number;
+ } | null>(null);
+
+ // Scan for videos in the selected path
+ const scanForVideos = async () => {
+ if (!path.trim()) return;
+
+ try {
+ console.log("starting video scan for path:", path);
+ setIsScanning(true);
+
+ // recursively read directory
+ const entries = await readDir(path);
+ console.log("found directory entries:", entries);
+
+ if (entries.length > 10) {
+ toast({
+ title: "too many files",
+ description: "please select a directory with 10 or fewer files",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ const videos = await Promise.all(entries.map((e) => join(path, e.name)));
+ console.log("filtered video files:", videos);
+ setDetectedVideos(videos);
+
+ // initialize metadata config for each video
+ const newMetadataConfig = videos.map((file_path) => ({
+ file_path,
+ metadata: {
+ name: "",
+ creation_time: new Date().toISOString(),
+ fps: 30,
+ device_name: "",
+ },
+ }));
+ console.log("initialized metadata config:", newMetadataConfig);
+ setMetadataConfig(newMetadataConfig);
+
+ if (videos.length === 0) {
+ toast({
+ title: "no videos found",
+ description:
+ "no supported video files found in the selected directory",
+ variant: "destructive",
+ });
+ } else {
+ toast({
+ title: "videos detected",
+ description: `found ${videos.length} video files`,
+ });
+ }
+ } catch (error: any) {
+ console.error("scan error:", error);
+ toast({
+ title: "scanning failed",
+ description: error.toString(),
+ variant: "destructive",
+ });
+ } finally {
+ setIsScanning(false);
+ }
+ };
+
+ const handleMetadataChange = (
+ index: number,
+ field: string,
+ value: string | number
+ ) => {
+ console.log("metadata change:", { index, field, value });
+ setMetadataConfig((prev) => {
+ const updated = [...prev];
+ updated[index] = {
+ ...updated[index],
+ metadata: {
+ ...updated[index].metadata,
+ [field]: value,
+ },
+ };
+ console.log("updated metadata config:", updated[index]);
+ return updated;
+ });
+ };
+
+ useEffect(() => {
+ if (path.trim()) {
+ scanForVideos();
+ }
+ }, [path]);
+
+ const handleIndex = async () => {
+ if (!path.trim()) return;
+
+ try {
+ console.log("starting indexing process for path:", path);
+ setIsIndexing(true);
+ setProgress(null);
+
+ const configFileName = `metadata-override-${Date.now()}.json`;
+ const configData = { overrides: metadataConfig };
+ console.log("writing metadata config:", configData);
+ console.log(
+ "writing metadata config with paths:",
+ metadataConfig.map((m) => m.file_path)
+ );
+ await writeTextFile(configFileName, JSON.stringify(configData), {
+ baseDir: BaseDirectory.AppLocalData,
+ });
+
+ const configPath = await join(await appLocalDataDir(), configFileName);
+ console.log("config file path:", configPath);
+
+ const command = TauriCommand.sidecar("screenpipe", [
+ "add",
+ path.trim(),
+ "--metadata-override",
+ configPath,
+ "--output",
+ "json",
+ ]);
+ console.log("executing command:", command);
+
+ command.stdout.on("data", (line) => {
+ console.log("command output:", line);
+ if (line.includes("found")) {
+ const match = line.match(/found (\d+) video files/);
+ if (match) {
+ setProgress({ current: 0, total: parseInt(match[1]) });
+ }
+ }
+ if (line.includes("processing video:")) {
+ setProgress((prev) =>
+ prev ? { ...prev, current: prev.current + 1 } : null
+ );
+ }
+ });
+
+ const output = await command.execute();
+ console.log("command execution result:", output);
+
+ if (output.code === 0) {
+ toast({
+ title: "data imported",
+ description: "your data has been successfully imported",
+ });
+ } else {
+ throw new Error(output.stderr);
+ }
+ } catch (error: any) {
+ console.error("import error:", error);
+ toast({
+ title: "import failed",
+ description: error.toString(),
+ variant: "destructive",
+ });
+ } finally {
+ setIsIndexing(false);
+ setProgress(null);
+ }
+ };
+
+ const handleSelectFolder = async () => {
+ try {
+ console.log("opening folder selector");
+ const selected = await open({
+ directory: true,
+ multiple: false,
+ });
+ console.log("selected folder:", selected);
+
+ if (selected && typeof selected === "string") {
+ setPath(selected);
+ }
+ } catch (error: any) {
+ console.error("folder selection error:", error);
+ toast({
+ title: "folder selection failed",
+ description: error.toString(),
+ variant: "destructive",
+ });
+ }
+ };
+
+ return (
+ <div className="w-full space-y-6 py-4">
+ <div>
+ <h1 className="text-2xl font-bold">data import</h1>
+ <p className="text-sm text-gray-500">
+ add your own video recordings (mp4, mov, avi) into screenpipe
+ </p>
+ </div>
+
+ <div className="space-y-4">
+ <div className="flex gap-2">
+ <Input
+ placeholder="enter path to index (e.g., /path/to/files)"
+ value={path}
+ onChange={(e) => setPath(e.target.value)}
+ className="font-mono"
+ />
+ <Button
+ onClick={handleSelectFolder}
+ variant="outline"
+ className="whitespace-nowrap"
+ >
+ <FolderOpen className="h-4 w-4 mr-2" />
+ select folder
+ </Button>
+ </div>
+
+ {/* Metadata Configuration Section */}
+ {detectedVideos.length > 0 && (
+ <Card className="mt-4">
+ <CardContent className="pt-6">
+ <h3 className="text-lg font-semibold mb-4">
+ configure video metadata
+ </h3>
+ <Accordion type="single" collapsible className="w-full">
+ {detectedVideos.map((video, index) => (
+ <AccordionItem key={video} value={`video-${index}`}>
+ <AccordionTrigger className="text-sm">
+ {video.split("/").pop()}
+ </AccordionTrigger>
+ <AccordionContent>
+ <div className="space-y-4 p-4">
+ <div className="grid gap-4">
+ <div className="space-y-2">
+ <Label>custom name</Label>
+ <Input
+ placeholder="enter a custom name for this video"
+ value={metadataConfig[index]?.metadata.name || ""}
+ autoCorrect="off"
+ autoComplete="off"
+ autoCapitalize="off"
+ onChange={(e) =>
+ handleMetadataChange(
+ index,
+ "name",
+ e.target.value
+ )
+ }
+ />
+ </div>
+ <div className="space-y-2">
+ <Label>device name</Label>
+ <Input
+ placeholder="enter device name"
+ value={
+ metadataConfig[index]?.metadata.device_name ||
+ ""
+ }
+ autoCorrect="off"
+ autoComplete="off"
+ autoCapitalize="off"
+ onChange={(e) =>
+ handleMetadataChange(
+ index,
+ "device_name",
+ e.target.value
+ )
+ }
+ />
+ </div>
+ <div className="space-y-2">
+ <Label>fps</Label>
+ <Input
+ type="number"
+ placeholder="enter fps (optional)"
+ value={metadataConfig[index]?.metadata.fps || ""}
+ onChange={(e) =>
+ handleMetadataChange(
+ index,
+ "fps",
+ parseFloat(e.target.value)
+ )
+ }
+ />
+ </div>
+ <div className="space-y-2">
+ <Label>creation time</Label>
+ <Input
+ type="datetime-local"
+ value={
+ metadataConfig[
+ index
+ ]?.metadata.creation_time?.split("Z")[0] || ""
+ }
+ onChange={(e) =>
+ handleMetadataChange(
+ index,
+ "creation_time",
+ new Date(e.target.value).toISOString()
+ )
+ }
+ />
+ </div>
+ </div>
+ </div>
+ </AccordionContent>
+ </AccordionItem>
+ ))}
+ </Accordion>
+ </CardContent>
+ </Card>
+ )}
+
+ {detectedVideos.length > 0 && (
+ <div className="flex items-center gap-4">
+ <Button onClick={handleIndex} disabled={isIndexing}>
+ <Command className="h-4 w-4 mr-2" />
+ {isIndexing ? "importing..." : "start import"}
+ </Button>
+
+ {/* Progress indicator */}
+ {isIndexing && (
+ <div className="flex-1 text-sm text-muted-foreground space-y-2">
+ <div className="flex items-center gap-2">
+ <div className="animate-spin h-4 w-4 border-2 border-primary border-t-transparent rounded-full" />
+ <span>
+ {progress
+ ? `processing ${progress.current}/${progress.total} videos...`
+ : "analyzing files..."}
+ </span>
+ </div>
+ {progress && (
+ <div className="h-1 bg-secondary rounded-full overflow-hidden">
+ <div
+ className="h-full bg-primary transition-all duration-300"
+ style={{
+ width: `${(progress.current / progress.total) * 100}%`,
+ }}
+ />
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 05b2805b4..9c35bbfbd 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5165,7 +5165,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.25.7"
+version = "0.25.9"
dependencies = [
"anyhow",
"axum",
diff --git a/screenpipe-app-tauri/src-tauri/capabilities/main.json b/screenpipe-app-tauri/src-tauri/capabilities/main.json
index 4951140df..677855113 100644
--- a/screenpipe-app-tauri/src-tauri/capabilities/main.json
+++ b/screenpipe-app-tauri/src-tauri/capabilities/main.json
@@ -135,37 +135,7 @@
{
"name": "screenpipe",
"cmd": "screenpipe",
- "args": [
- "pipe",
- "purge",
- "-y"
- ],
- "sidecar": true
- }
- ]
- },
- {
- "identifier": "shell:allow-spawn",
- "allow": [
- {
- "name": "screenpipe",
- "cmd": "screenpipe",
- "args": [
- "setup"
- ],
- "sidecar": true
- }
- ]
- },
- {
- "identifier": "shell:allow-spawn",
- "allow": [
- {
- "name": "screenpipe",
- "cmd": "screenpipe",
- "args": [
- "migrate"
- ],
+ "args": true,
"sidecar": true
}
]
@@ -366,6 +336,18 @@
}
]
},
- "deep-link:default"
+ "deep-link:default",
+ "fs:allow-write-text-file",
+ {
+ "identifier": "fs:scope",
+ "allow": [
+ {
+ "path": "$APPLOCALDATA"
+ },
+ {
+ "path": "$APPLOCALDATA/**"
+ }
+ ]
+ }
]
}
diff --git a/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json b/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
index 500305642..e65218e77 100644
--- a/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
+++ b/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
@@ -1 +1 @@
-{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","shell:allow-open","store:default","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default","sentry:default",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","purge","-y"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["setup"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["migrate"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["serve"],"cmd":"ollama","name":"ollama","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["run",{"validator":"\\S*"}],"cmd":"ollama","name":"ollama-run","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","core:webview:allow-internal-toggle-devtools",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]},"deep-link:default"]}}
\ No newline at end of file
+{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","remote":{"urls":["http://localhost:*"]},"local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","shell:allow-open","store:default","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default","sentry:default",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["serve"],"cmd":"ollama","name":"ollama","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["run",{"validator":"\\S*"}],"cmd":"ollama","name":"ollama-run","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","core:webview:allow-internal-toggle-devtools",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]},"deep-link:default","fs:allow-write-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPLOCALDATA"},{"path":"$APPLOCALDATA/**"}]}]}}
\ No newline at end of file
diff --git a/screenpipe-core/Cargo.toml b/screenpipe-core/Cargo.toml
index b8bdde51f..9a9b1316b 100644
--- a/screenpipe-core/Cargo.toml
+++ b/screenpipe-core/Cargo.toml
@@ -48,6 +48,7 @@ once_cell = "1.19.0"
cron = "0.13.0"
chrono = "0.4.38"
+sentry = { workspace = true }
[features]
default = ["pipes", "security"]
diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rs
index 1c7880ca5..89b39f526 100644
--- a/screenpipe-core/src/pipes.rs
+++ b/screenpipe-core/src/pipes.rs
@@ -3,6 +3,8 @@
mod pipes {
use dirs::home_dir;
use regex::Regex;
+ use sentry;
+ use serde_json::Value;
use std::collections::HashMap;
use std::future::Future;
use std::path::PathBuf;
@@ -11,8 +13,6 @@ mod pipes {
use tokio::process::Command;
use tokio::sync::watch;
- use serde_json::Value;
-
use anyhow::Result;
use std::fs;
use std::path::Path;
@@ -83,7 +83,11 @@ mod pipes {
pipe: &str,
screenpipe_dir: PathBuf,
) -> Result<(tokio::process::Child, PipeState)> {
- let bun_path = find_bun_path().ok_or_else(|| anyhow::anyhow!("bun not found"))?;
+ let bun_path = find_bun_path().ok_or_else(|| {
+ let err = anyhow::anyhow!("bun not found");
+ sentry::capture_error(&err.source().unwrap());
+ err
+ })?;
let pipe_dir = screenpipe_dir.join("pipes").join(pipe);
let pipe_json_path = pipe_dir.join("pipe.json");
let package_json_path = pipe_dir.join("package.json");
@@ -240,11 +244,14 @@ mod pipes {
.await?;
if !install_output.status.success() {
- error!(
- "failed to install dependencies: {}",
- String::from_utf8_lossy(&install_output.stderr)
+ let err_msg = String::from_utf8_lossy(&install_output.stderr);
+ error!("failed to install dependencies: {}", err_msg);
+ let err = anyhow::anyhow!(
+ "failed to install dependencies for next.js pipe: {}",
+ err_msg
);
- anyhow::bail!("failed to install dependencies for next.js pipe");
+ sentry::capture_error(&err.source().unwrap());
+ anyhow::bail!(err);
}
debug!("successfully installed dependencies for next.js pipe");
} else {
@@ -369,6 +376,11 @@ mod pipes {
info!("[{}] {}", pipe_clone, line);
} else {
error!("[{}] {}", pipe_clone, line);
+ // Capture error in Sentry
+ sentry::capture_message(
+ &format!("[{}] {}", pipe_clone, line),
+ sentry::Level::Error,
+ );
}
}
});
@@ -938,7 +950,9 @@ mod pipes {
let schedule = match cron::Schedule::from_str(schedule) {
Ok(s) => s,
Err(e) => {
- error!("invalid cron schedule: {}", e);
+ let err_msg = format!("invalid cron schedule: {}", e);
+ error!("{}", err_msg);
+ sentry::capture_error(&anyhow::anyhow!(err_msg).source().unwrap());
return;
}
};
@@ -1010,20 +1024,25 @@ mod pipes {
.await
{
Ok(res) => {
- if res.status().is_success() {
- // Save successful execution time
- if let Err(e) = save_cron_execution(&pipe_dir, path).await {
- error!("failed to save cron execution time: {}", e);
- }
- debug!("cron job executed successfully");
- } else {
- error!("cron job failed with status: {}", res.status());
+ if !res.status().is_success() {
+ let err_msg = format!("cron job failed with status: {}", res.status());
+ error!("{}", err_msg);
if let Ok(text) = res.text().await {
error!("error response: {}", text);
+ sentry::capture_message(
+ &format!("{}: {}", err_msg, text),
+ sentry::Level::Error
+ );
+ } else {
+ sentry::capture_message(&err_msg, sentry::Level::Error);
}
}
}
- Err(e) => error!("failed to execute cron job: {}", e),
+ Err(e) => {
+ let err_msg = format!("failed to execute cron job: {}", e);
+ error!("{}", err_msg);
+ sentry::capture_error(&e);
+ }
}
}
Ok(()) = shutdown.changed() => {
diff --git a/screenpipe-js/browser-sdk/package.json b/screenpipe-js/browser-sdk/package.json
index 5c3d09c54..941b5c4f5 100644
--- a/screenpipe-js/browser-sdk/package.json
+++ b/screenpipe-js/browser-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@screenpipe/browser",
- "version": "0.1.17",
+ "version": "0.1.18-beta.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -37,8 +37,12 @@
},
"typesVersions": {
"*": {
- "node": ["./dist/node.d.ts"],
- "browser": ["./dist/browser.d.ts"]
+ "node": [
+ "./dist/node.d.ts"
+ ],
+ "browser": [
+ "./dist/browser.d.ts"
+ ]
}
}
}
diff --git a/screenpipe-js/common/types.ts b/screenpipe-js/common/types.ts
index 2921252dd..1b5635106 100644
--- a/screenpipe-js/common/types.ts
+++ b/screenpipe-js/common/types.ts
@@ -28,6 +28,7 @@ export interface ScreenpipeQueryParams {
minLength?: number;
maxLength?: number;
speakerIds?: number[];
+ frameName?: string;
}
/**
@@ -43,6 +44,7 @@ export interface OCRContent {
windowName: string;
tags: string[];
frame?: string;
+ frameName?: string;
}
/**
diff --git a/screenpipe-server/src/add.rs b/screenpipe-server/src/add.rs
index 249b16cbe..3a9747f8e 100644
--- a/screenpipe-server/src/add.rs
+++ b/screenpipe-server/src/add.rs
@@ -9,6 +9,7 @@ use screenpipe_vision::perform_ocr_apple;
#[cfg(target_os = "windows")]
use screenpipe_vision::perform_ocr_windows;
+#[allow(unused)]
use screenpipe_vision::perform_ocr_tesseract;
use serde_json::json;
@@ -16,8 +17,8 @@ use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::fs;
-use tokio::sync::mpsc;
-use tracing::{debug, error, info};
+use tracing::error;
+use tracing::{debug, info};
use uuid::Uuid;
use walkdir::WalkDir;
@@ -79,12 +80,41 @@ pub async fn handle_index_command(
let mut total_text = 0;
// Setup channel for OCR results
- let (tx, mut rx) = mpsc::channel::<(i64, String, f64)>(100);
+
+ // At the start of handle_index_command, if JSON output is selected, print the stream start
+ match output_format {
+ crate::cli::OutputFormat::Json => {
+ println!("{{\"version\":1,\"stream\":["); // Start of JSON stream
+ }
+ _ => {}
+ }
for video_path in video_files {
info!("processing video: {}", video_path.display());
- let video_path_for_processing = if copy_videos {
+ // Get metadata override before copying file
+ let mut metadata = get_video_metadata(video_path.to_str().unwrap()).await?;
+
+ // Apply metadata override if provided and matches the file
+ if let Some(ref overrides) = metadata_overrides {
+ let file_str = video_path.to_string_lossy();
+ println!("checking override for path: {}", file_str);
+ println!("available overrides: {:?}", overrides);
+
+ if let Some(override_item) = overrides
+ .overrides
+ .iter()
+ .find(|item| item.file_path == file_str)
+ {
+ println!("found matching override: {:?}", override_item);
+ override_item.metadata.apply_to(&mut metadata);
+ println!("metadata after override: {:?}", metadata);
+ } else {
+ println!("no matching override found");
+ }
+ }
+
+ let video_path = if copy_videos {
// Generate unique filename using UUID
let ext = video_path.extension().unwrap_or_default();
let new_filename = format!("{}.{}", Uuid::new_v4(), ext.to_string_lossy());
@@ -101,38 +131,21 @@ pub async fn handle_index_command(
video_path.clone()
};
- let video_path = &video_path_for_processing;
- let mut metadata = get_video_metadata(video_path.to_str().unwrap()).await?;
-
- // Apply metadata override if provided and matches the file
- if let Some(ref overrides) = metadata_overrides {
- let file_str = video_path.to_string_lossy();
-
- if let Some(override_item) = overrides
- .overrides
- .iter()
- .find(|item| item.file_path == file_str)
- {
- override_item.metadata.apply_to(&mut metadata);
- }
- }
-
let frames = extract_frames_from_video(&video_path, None).await?;
// Create video chunk and frames first
- db.process_video_frames(
- video_path.to_str().unwrap(),
- frames.clone(),
- metadata.clone(),
- )
- .await?;
+ let frame_ids = db
+ .create_video_with_frames(
+ video_path.to_str().unwrap(),
+ frames.clone(),
+ metadata.clone(),
+ )
+ .await?;
let mut previous_image: Option<DynamicImage> = None;
let mut frame_counter: i64 = 0;
- let mut ocr_batch = Vec::new();
- let mut embed_batch = Vec::new();
- for (_, frame) in frames.iter().enumerate() {
+ for (idx, frame) in frames.iter().enumerate() {
// Compare with previous frame to skip similar ones
let current_average = if let Some(prev) = &previous_image {
compare_with_previous_image(
@@ -173,27 +186,21 @@ pub async fn handle_index_command(
}
};
- let tx = tx.clone();
- let frame_num = frame_counter;
- let frame = frame.clone();
- let engine_clone = engine.clone();
-
- let engine_arc = Arc::new(engine_clone);
- tokio::spawn(async move {
- let engine_clone = engine.clone();
+ let engine_arc = Arc::new(engine.clone());
- let (text, _, confidence) = match engine_clone.clone() {
- #[cfg(target_os = "macos")]
- OcrEngine::AppleNative => perform_ocr_apple(&frame, &[]),
- #[cfg(target_os = "windows")]
- OcrEngine::WindowsNative => perform_ocr_windows(&frame).await.unwrap(),
- _ => {
- #[cfg(not(any(target_os = "macos", target_os = "windows")))]
- return perform_ocr_tesseract(&frame, vec![]);
+ // Do OCR processing directly
+ let (text, _, confidence) = match engine.clone() {
+ #[cfg(target_os = "macos")]
+ OcrEngine::AppleNative => perform_ocr_apple(&frame, &[]),
+ #[cfg(target_os = "windows")]
+ OcrEngine::WindowsNative => perform_ocr_windows(&frame).await.unwrap(),
+ _ => {
+ #[cfg(not(any(target_os = "macos", target_os = "windows")))]
+ perform_ocr_tesseract(&frame, vec![]);
- panic!("unsupported ocr engine");
- }
- };
+ panic!("unsupported ocr engine");
+ }
+ };
if let Ok(()) = tx.send((frame_num, text, confidence.unwrap_or(0.0))).await {
debug!("processed frame {}", frame_num);
@@ -223,12 +230,14 @@ pub async fn handle_index_command(
}
}
- ocr_batch.push((
- frame_num as i64,
- text.clone(),
- "{}".to_string(), // empty json
- "".to_string(), // no app name
- "".to_string(), // no window name
+ // Process OCR directly instead of batching
+ if let Err(e) = db
+ .insert_ocr_text(
+ frame_ids[idx],
+ &text,
+ "{}", // empty json
+ "", // no app name
+ "", // no window name
engine_arc.clone(),
true, // focused
));
@@ -253,18 +262,37 @@ pub async fn handle_index_command(
match output_format {
crate::cli::OutputFormat::Json => {
println!(
+ )
+ .await
+ {
+ error!("error inserting ocr text: {}", e);
+ }
+ info!("inserted ocr text for frame {}", frame_ids[idx]);
+
+ // Handle output formatting
+ match output_format {
+ crate::cli::OutputFormat::Json => {
+ if !text.is_empty() {
+ if total_frames > 0 {
+ print!(",");
+ }
+ print!(
"{}",
serde_json::to_string(&json!({
- "frame": frame_num,
- "text": text,
- "confidence": confidence
+ "type": "frame",
+ "data": {
+ "frame_number": frame_counter,
+ "text": text,
+ "confidence": confidence.unwrap_or(0.0),
+ "video_path": video_path.to_string_lossy()
+ }
}))?
);
}
- crate::cli::OutputFormat::Text => {
- if !text.is_empty() {
- debug!("frame {}: {}", frame_num, text);
- }
+ }
+ crate::cli::OutputFormat::Text => {
+ if !text.is_empty() {
+ debug!("frame {}: {}", frame_counter, text);
}
}
}
@@ -289,17 +317,33 @@ pub async fn handle_index_command(
// wait few seconds for remaining OCR tasks
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
- // Process remaining results
- while let Ok((_, text, _)) = rx.try_recv() {
- total_frames += 1;
- total_text += text.len();
+ // At the end, close the JSON array
+ match output_format {
+ crate::cli::OutputFormat::Json => {
+ // Add final summary item
+ if total_frames > 0 {
+ print!(",");
+ }
+ print!(
+ "{}",
+ serde_json::to_string(&json!({
+ "type": "summary",
+ "data": {
+ "total_frames": total_frames,
+ "total_text_chars": total_text
+ }
+ }))?
+ );
+ println!("]}}"); // End of JSON stream
+ }
+ crate::cli::OutputFormat::Text => {
+ info!(
+ "processed {} frames, extracted {} characters of text",
+ total_frames, total_text
+ );
+ }
}
- info!(
- "processed {} frames, extracted {} characters of text",
- total_frames, total_text
- );
-
Ok(())
}
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 4f2a6fb39..c65ebcf84 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -287,9 +287,25 @@ async fn main() -> anyhow::Result<()> {
ocr_engine,
metadata_override,
copy_videos,
+ debug,
use_embedding,
} => {
let local_data_dir = get_base_dir(&data_dir)?;
+
+ // Update logging filter if debug is enabled
+ if debug {
+ tracing::subscriber::set_global_default(
+ tracing_subscriber::registry()
+ .with(
+ EnvFilter::from_default_env()
+ .add_directive("screenpipe=debug".parse().unwrap()),
+ )
+ .with(fmt::layer().with_writer(std::io::stdout)),
+ )
+ .ok();
+ debug!("debug logging enabled");
+ }
+
let db = Arc::new(
DatabaseManager::new(&format!(
"{}/db.sqlite",
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index 7d8b1ce04..7dbf57ab3 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -298,7 +298,7 @@ pub enum Command {
#[arg(long)]
data_dir: Option<String>,
/// Output format
- #[arg(short, long, value_enum, default_value_t = OutputFormat::Text)]
+ #[arg(short = 'o', long, value_enum, default_value_t = OutputFormat::Text)]
output: OutputFormat,
/// Regex pattern to filter files (e.g. "monitor.*\.mp4$")
#[arg(long)]
@@ -312,6 +312,9 @@ pub enum Command {
/// Copy videos to screenpipe data directory
#[arg(long, default_value_t = true)]
copy_videos: bool,
+ /// Enable debug logging for screenpipe modules
+ #[arg(long)]
+ debug: bool,
/// Enable embedding generation for OCR text
#[arg(long, default_value_t = false)]
use_embedding: bool,
diff --git a/screenpipe-server/src/db.rs b/screenpipe-server/src/db.rs
index b8aabd4e4..60127e6fb 100644
--- a/screenpipe-server/src/db.rs
+++ b/screenpipe-server/src/db.rs
@@ -7,14 +7,13 @@ use screenpipe_vision::OcrEngine;
use sqlite_vec::sqlite3_vec_init;
use sqlx::migrate::MigrateDatabase;
use sqlx::sqlite::{SqlitePool, SqlitePoolOptions};
+use sqlx::Column;
use sqlx::Error as SqlxError;
use sqlx::Row;
use sqlx::TypeInfo;
use sqlx::ValueRef;
-use sqlx::{Column, QueryBuilder};
use std::sync::Arc;
use std::time::Duration;
-use tracing::info;
use std::collections::BTreeMap;
use tokio::time::{timeout, Duration as TokioDuration};
@@ -80,15 +79,11 @@ impl DatabaseManager {
let db_manager = DatabaseManager { pool };
- info!("running migrations");
-
// Run migrations after establishing the connection
if let Err(e) = Self::run_migrations(&db_manager.pool).await {
- error!("Failed to run migrations: {}", e);
return Err(e);
}
- info!("migrations executed successfully.");
Ok(db_manager)
}
@@ -299,18 +294,18 @@ impl DatabaseManager {
let mut tx = self.pool.begin().await?;
debug!("insert_frame Transaction started");
- // Get the most recent video_chunk_id
- let video_chunk_id: Option<i64> = sqlx::query_scalar(
- "SELECT id FROM video_chunks WHERE device_name = ?1 ORDER BY id DESC LIMIT 1",
+ // Get the most recent video_chunk_id and file_path
+ let video_chunk: Option<(i64, String)> = sqlx::query_as(
+ "SELECT id, file_path FROM video_chunks WHERE device_name = ?1 ORDER BY id DESC LIMIT 1",
)
.bind(device_name)
.fetch_optional(&mut *tx)
.await?;
- debug!("Fetched most recent video_chunk_id: {:?}", video_chunk_id);
+ debug!("Fetched most recent video_chunk: {:?}", video_chunk);
// If no video chunk is found, return 0
- let video_chunk_id = match video_chunk_id {
- Some(id) => id,
+ let (video_chunk_id, file_path) = match video_chunk {
+ Some((id, path)) => (id, path),
None => {
debug!("No video chunk found, rolling back transaction");
tx.rollback().await?;
@@ -329,13 +324,14 @@ impl DatabaseManager {
let timestamp = timestamp.unwrap_or_else(Utc::now);
- // Insert the new frame
+ // Insert the new frame with file_path as name
let id = sqlx::query(
- "INSERT INTO frames (video_chunk_id, offset_index, timestamp) VALUES (?1, ?2, ?3)",
+ "INSERT INTO frames (video_chunk_id, offset_index, timestamp, name) VALUES (?1, ?2, ?3, ?4)",
)
.bind(video_chunk_id)
.bind(offset_index)
.bind(timestamp)
+ .bind(file_path)
.execute(&mut *tx)
.await?
.last_insert_rowid();
@@ -343,7 +339,6 @@ impl DatabaseManager {
// Commit the transaction
tx.commit().await?;
- // debug!("insert_frame Transaction committed");
Ok(id)
}
@@ -469,13 +464,14 @@ impl DatabaseManager {
min_length: Option<usize>,
max_length: Option<usize>,
speaker_ids: Option<Vec<i64>>,
+ frame_name: Option<&str>,
) -> Result<Vec<SearchResult>, sqlx::Error> {
let mut results = Vec::new();
match content_type {
ContentType::All => {
let (ocr_results, audio_results, ui_results) =
- if app_name.is_none() && window_name.is_none() {
+ if app_name.is_none() && window_name.is_none() && frame_name.is_none() {
// Run all three queries in parallel
let (ocr, audio, ui) = tokio::try_join!(
self.search_ocr(
@@ -488,6 +484,7 @@ impl DatabaseManager {
window_name,
min_length,
max_length,
+ frame_name,
),
self.search_audio(
query,
@@ -523,6 +520,7 @@ impl DatabaseManager {
window_name,
min_length,
max_length,
+ frame_name,
),
self.search_ui_monitoring(
query,
@@ -555,6 +553,7 @@ impl DatabaseManager {
window_name,
min_length,
max_length,
+ frame_name,
)
.await?;
results.extend(ocr_results.into_iter().map(SearchResult::OCR));
@@ -630,6 +629,7 @@ impl DatabaseManager {
window_name,
min_length,
max_length,
+ frame_name,
)
.await?;
let ui_results = self
@@ -671,6 +671,7 @@ impl DatabaseManager {
window_name,
min_length,
max_length,
+ frame_name,
)
.await?;
@@ -715,6 +716,7 @@ impl DatabaseManager {
window_name: Option<&str>,
min_length: Option<usize>,
max_length: Option<usize>,
+ frame_name: Option<&str>,
) -> Result<Vec<OCRResult>, sqlx::Error> {
let base_sql = if query.is_empty() {
"ocr_text"
@@ -735,6 +737,7 @@ impl DatabaseManager {
ocr_text.text as ocr_text,
ocr_text.text_json,
frames.timestamp,
+ frames.name as frame_name,
video_chunks.file_path,
frames.offset_index,
ocr_text.app_name,
@@ -754,6 +757,7 @@ impl DatabaseManager {
AND (?5 IS NULL OR LENGTH(ocr_text.text) <= ?5)
AND (?6 IS NULL OR ocr_text.app_name LIKE '%' || ?6 || '%' COLLATE NOCASE)
AND (?7 IS NULL OR ocr_text.window_name LIKE '%' || ?7 || '%' COLLATE NOCASE)
+ AND (?10 IS NULL OR frames.name LIKE '%' || ?10 || '%' COLLATE NOCASE)
GROUP BY ocr_text.frame_id
ORDER BY frames.timestamp DESC
LIMIT ?8 OFFSET ?9
@@ -771,6 +775,7 @@ impl DatabaseManager {
.bind(window_name)
.bind(limit)
.bind(offset)
+ .bind(frame_name)
.fetch_all(&self.pool)
.await?;
@@ -781,6 +786,7 @@ impl DatabaseManager {
ocr_text: raw.ocr_text,
text_json: raw.text_json,
timestamp: raw.timestamp,
+ frame_name: raw.frame_name,
file_path: raw.file_path,
offset_index: raw.offset_index,
app_name: raw.app_name,
@@ -936,6 +942,7 @@ impl DatabaseManager {
min_length: Option<usize>,
max_length: Option<usize>,
speaker_ids: Option<Vec<i64>>,
+ frame_name: Option<&str>,
) -> Result<usize, sqlx::Error> {
let mut json_array: String = "[]".to_string();
if let Some(ids) = speaker_ids {
@@ -959,6 +966,7 @@ impl DatabaseManager {
AND (?5 IS NULL OR ocr_text.window_name LIKE '%' || ?5 || '%')
AND (?6 IS NULL OR LENGTH(ocr_text.text) >= ?6)
AND (?7 IS NULL OR LENGTH(ocr_text.text) <= ?7)
+ AND (?8 IS NULL OR frames.name LIKE '%' || ?8 || '%' COLLATE NOCASE)
"#,
if query.is_empty() {
"1=1"
@@ -1022,6 +1030,7 @@ impl DatabaseManager {
AND (?5 IS NULL OR ocr_text.window_name LIKE '%' || ?5 || '%')
AND (?6 IS NULL OR LENGTH(ocr_text.text) >= ?6)
AND (?7 IS NULL OR LENGTH(ocr_text.text) <= ?7)
+ AND (?8 IS NULL OR frames.name LIKE '%' || ?8 || '%' COLLATE NOCASE)
AND ocr_text.text != 'No text found'
UNION ALL
@@ -1090,6 +1099,7 @@ impl DatabaseManager {
.bind(end_time)
.bind(app_name)
.bind(window_name)
+ .bind(frame_name)
.bind(min_length.map(|len| len as i64))
.bind(max_length.map(|len| len as i64))
.bind(json_array)
@@ -1498,7 +1508,7 @@ impl DatabaseManager {
AND (?4 IS NULL OR ui_monitoring.app LIKE '%' || ?4 || '%')
AND (?5 IS NULL OR ui_monitoring.window LIKE '%' || ?5 || '%')
ORDER BY ui_monitoring.timestamp DESC
- LIMIT ?6 OFFSET ?7
+ LIMIT ?7 OFFSET ?8
"#,
base_sql, where_clause
);
@@ -1825,52 +1835,17 @@ impl DatabaseManager {
Ok(())
}
- pub async fn batch_insert_ocr(
- &self,
- frames: Vec<(i64, String, String, String, String, Arc<OcrEngine>, bool)>,
- ) -> Result<(), sqlx::Error> {
- let mut tx = self.pool.begin().await?;
-
- // Prepare batch insert statement
- let mut query_builder = QueryBuilder::new(
- "INSERT INTO ocr_text (frame_id, text, text_json, app_name, window_name, ocr_engine, focused) "
- );
-
- query_builder.push_values(
- &frames,
- |mut b, (frame_id, text, text_json, app_name, window_name, engine, focused)| {
- b.push_bind(frame_id)
- .push_bind(text)
- .push_bind(text_json)
- .push_bind(app_name)
- .push_bind(window_name)
- .push_bind(format!("{:?}", *engine))
- .push_bind(focused);
- },
- );
-
- query_builder.build().execute(&mut *tx).await?;
-
- // Also update FTS table in batch
- let mut fts_query_builder = QueryBuilder::new("INSERT INTO ocr_text_fts (frame_id, text) ");
-
- fts_query_builder.push_values(&frames, |mut b, (frame_id, text, ..)| {
- b.push_bind(frame_id).push_bind(text);
- });
-
- fts_query_builder.build().execute(&mut *tx).await?;
-
- tx.commit().await?;
- Ok(())
- }
-
- pub async fn process_video_frames(
+ pub async fn create_video_with_frames(
&self,
file_path: &str,
frames: Vec<DynamicImage>,
metadata: VideoMetadata,
- ) -> Result<(), sqlx::Error> {
+ ) -> Result<Vec<i64>, sqlx::Error> {
let mut tx = self.pool.begin().await?;
+ debug!(
+ "creating video chunk {}, metadata: {:?}",
+ &file_path, &metadata
+ );
// Use metadata.device_name or default to "imported_files"
let device_name = metadata.device_name.unwrap_or_else(|| "imported_files".to_string());
@@ -1884,24 +1859,22 @@ impl DatabaseManager {
.await?
.last_insert_rowid();
- debug!("created video chunk: {} for {}", video_chunk_id, file_path);
-
- // 2. Create frames with correct timestamps
+ // 2. Create frames with correct timestamps and default name
let mut frame_ids = Vec::with_capacity(frames.len());
for (i, _frame) in frames.iter().enumerate() {
- // Calculate timestamp for this frame based on creation time and frame number
let frame_timestamp = metadata.creation_time
+ chrono::Duration::milliseconds((i as f64 * (1000.0 / metadata.fps)) as i64);
debug!("frame timestamp: {}", frame_timestamp);
let frame_id = sqlx::query(
- "INSERT INTO frames (video_chunk_id, offset_index, timestamp) VALUES (?1, ?2, ?3)",
+ "INSERT INTO frames (video_chunk_id, offset_index, timestamp, name) VALUES (?1, ?2, ?3, ?4)",
)
.bind(video_chunk_id)
.bind(i as i64)
.bind(frame_timestamp)
+ .bind(metadata.name.as_deref().unwrap_or(file_path)) // Use reference instead of clone
.execute(&mut *tx)
.await?
.last_insert_rowid();
@@ -1916,7 +1889,7 @@ impl DatabaseManager {
video_chunk_id
);
- Ok(())
+ Ok(frame_ids)
}
pub async fn batch_insert_embeddings(
@@ -2008,4 +1981,28 @@ impl DatabaseManager {
})
.collect())
}
+
+ // Add method to update frame names
+ pub async fn update_frame_name(&self, frame_id: i64, name: &str) -> Result<(), sqlx::Error> {
+ sqlx::query("UPDATE frames SET name = ?1 WHERE id = ?2")
+ .bind(name)
+ .bind(frame_id)
+ .execute(&self.pool)
+ .await?;
+ Ok(())
+ }
+
+ // Add method to update all frames in a video chunk
+ pub async fn update_video_chunk_frames_names(
+ &self,
+ video_chunk_id: i64,
+ name: &str,
+ ) -> Result<(), sqlx::Error> {
+ sqlx::query("UPDATE frames SET name = ?1 WHERE video_chunk_id = ?2")
+ .bind(name)
+ .bind(video_chunk_id)
+ .execute(&self.pool)
+ .await?;
+ Ok(())
+ }
}
diff --git a/screenpipe-server/src/db_types.rs b/screenpipe-server/src/db_types.rs
index f3b3b0b1d..064361df8 100644
--- a/screenpipe-server/src/db_types.rs
+++ b/screenpipe-server/src/db_types.rs
@@ -28,6 +28,7 @@ pub struct OCRResultRaw {
pub frame_id: i64,
pub ocr_text: String,
pub text_json: String,
+ pub frame_name: String,
pub timestamp: DateTime<Utc>,
pub file_path: String,
pub offset_index: i64,
@@ -40,6 +41,7 @@ pub struct OCRResultRaw {
#[derive(Debug, Serialize, Deserialize)]
pub struct OCRResult {
pub frame_id: i64,
+ pub frame_name: String,
pub ocr_text: String,
pub text_json: String,
pub timestamp: DateTime<Utc>,
@@ -129,6 +131,7 @@ pub struct UiContent {
pub initial_traversal_at: Option<DateTime<Utc>>,
pub file_path: String,
pub offset_index: i64,
+ pub frame_name: Option<String>,
}
#[derive(Debug, Clone)]
diff --git a/screenpipe-server/src/migrations/20250117180530_add_frame_names.sql b/screenpipe-server/src/migrations/20250117180530_add_frame_names.sql
new file mode 100644
index 000000000..52084f913
--- /dev/null
+++ b/screenpipe-server/src/migrations/20250117180530_add_frame_names.sql
@@ -0,0 +1,15 @@
+-- Add migration script here
+ALTER TABLE frames ADD COLUMN name TEXT;
+CREATE VIRTUAL TABLE frames_fts USING fts5(name, content='frames', content_rowid='id');
+-- Trigger to keep the FTS index up to date
+CREATE TRIGGER frames_ai AFTER INSERT ON frames BEGIN
+ INSERT INTO frames_fts(rowid, name) VALUES (new.id, new.name);
+END;
+CREATE TRIGGER frames_ad AFTER DELETE ON frames BEGIN
+ INSERT INTO frames_fts(frames_fts, rowid, name) VALUES('delete', old.id, old.name);
+END;
+CREATE TRIGGER frames_au AFTER UPDATE ON frames BEGIN
+ INSERT INTO frames_fts(frames_fts, rowid, name) VALUES('delete', old.id, old.name);
+ INSERT INTO frames_fts(rowid, name) VALUES (new.id, new.name);
+END;
+
diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rs
index eae177533..4624b488d 100644
--- a/screenpipe-server/src/server.rs
+++ b/screenpipe-server/src/server.rs
@@ -94,6 +94,8 @@ pub(crate) struct SearchQuery {
#[serde(default)]
window_name: Option<String>,
#[serde(default)]
+ frame_name: Option<String>,
+ #[serde(default)]
include_frames: bool,
#[serde(default)]
min_length: Option<usize>,
@@ -179,6 +181,7 @@ pub struct OCRContent {
pub window_name: String,
pub tags: Vec<String>,
pub frame: Option<String>,
+ pub frame_name: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
@@ -206,6 +209,7 @@ pub struct UiContent {
pub initial_traversal_at: Option<DateTime<Utc>>,
pub file_path: String,
pub offset_index: i64,
+ pub frame_name: Option<String>,
}
#[derive(Serialize)]
@@ -270,7 +274,7 @@ pub(crate) async fn search(
(StatusCode, JsonResponse<serde_json::Value>),
> {
info!(
- "received search request: query='{}', content_type={:?}, limit={}, offset={}, start_time={:?}, end_time={:?}, app_name={:?}, window_name={:?}, min_length={:?}, max_length={:?}, speaker_ids={:?}",
+ "received search request: query='{}', content_type={:?}, limit={}, offset={}, start_time={:?}, end_time={:?}, app_name={:?}, window_name={:?}, min_length={:?}, max_length={:?}, speaker_ids={:?}, frame_name={:?}",
query.q.as_deref().unwrap_or(""),
query.content_type,
query.pagination.limit,
@@ -281,7 +285,8 @@ pub(crate) async fn search(
query.window_name,
query.min_length,
query.max_length,
- query.speaker_ids
+ query.speaker_ids,
+ query.frame_name,
);
let query_str = query.q.as_deref().unwrap_or("");
@@ -301,6 +306,7 @@ pub(crate) async fn search(
query.min_length,
query.max_length,
query.speaker_ids.clone(),
+ query.frame_name.as_deref(),
),
state.db.count_search_results(
query_str,
@@ -312,6 +318,7 @@ pub(crate) async fn search(
query.min_length,
query.max_length,
query.speaker_ids.clone(),
+ query.frame_name.as_deref(),
),
)
.await
@@ -336,6 +343,7 @@ pub(crate) async fn search(
window_name: ocr.window_name.clone(),
tags: ocr.tags.clone(),
frame: None,
+ frame_name: Some(ocr.frame_name.clone()),
}),
SearchResult::Audio(audio) => ContentItem::Audio(AudioContent {
chunk_id: audio.audio_chunk_id,
@@ -359,6 +367,7 @@ pub(crate) async fn search(
initial_traversal_at: ui.initial_traversal_at,
file_path: ui.file_path.clone(),
offset_index: ui.offset_index,
+ frame_name: ui.frame_name.clone(),
}),
})
.collect();
@@ -1612,7 +1621,6 @@ async fn sse_transcription_handler(
))
}
-
#[derive(Deserialize)]
pub struct AudioDeviceControlRequest {
device_name: String,
@@ -1638,26 +1646,30 @@ async fn start_audio_device(
// Validate device exists
let available_devices = list_audio_devices().await.map_err(|e| {
- (StatusCode::INTERNAL_SERVER_ERROR,
- JsonResponse(json!({
- "error": format!("failed to list audio devices: {}", e),
- "success": false
- })))
+ (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ JsonResponse(json!({
+ "error": format!("failed to list audio devices: {}", e),
+ "success": false
+ })),
+ )
})?;
if !available_devices.contains(&device) {
- return Err((StatusCode::BAD_REQUEST,
+ return Err((
+ StatusCode::BAD_REQUEST,
JsonResponse(json!({
"error": format!("device not found: {}", device.name),
"success": false
- }))));
+ })),
+ ));
}
- let control = DeviceControl {
- is_running: true,
- is_paused: false
+ let control = DeviceControl {
+ is_running: true,
+ is_paused: false,
};
-
+
let _ = state.audio_devices_tx.send((device.clone(), control));
Ok(JsonResponse(AudioDeviceControlResponse {
@@ -1677,25 +1689,32 @@ async fn stop_audio_device(
// Validate device exists
let available_devices = list_audio_devices().await.map_err(|e| {
- (StatusCode::INTERNAL_SERVER_ERROR,
- JsonResponse(json!({
- "error": format!("failed to list audio devices: {}", e),
- "success": false
- })))
+ (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ JsonResponse(json!({
+ "error": format!("failed to list audio devices: {}", e),
+ "success": false
+ })),
+ )
})?;
if !available_devices.contains(&device) {
- return Err((StatusCode::BAD_REQUEST,
+ return Err((
+ StatusCode::BAD_REQUEST,
JsonResponse(json!({
"error": format!("device not found: {}", device.name),
"success": false
- }))));
+ })),
+ ));
}
-
- let _ = state.audio_devices_tx.send((device.clone(), DeviceControl {
- is_running: false,
- is_paused: false,
- }));
+
+ let _ = state.audio_devices_tx.send((
+ device.clone(),
+ DeviceControl {
+ is_running: false,
+ is_paused: false,
+ },
+ ));
Ok(JsonResponse(AudioDeviceControlResponse {
success: true,
@@ -1703,7 +1722,6 @@ async fn stop_audio_device(
}))
}
-
#[derive(Deserialize)]
struct VisionSSEQuery {
images: Option<bool>,
diff --git a/screenpipe-server/src/video_utils.rs b/screenpipe-server/src/video_utils.rs
index adce0d110..a8a7eef68 100644
--- a/screenpipe-server/src/video_utils.rs
+++ b/screenpipe-server/src/video_utils.rs
@@ -411,6 +411,7 @@ pub async fn get_video_metadata(video_path: &str) -> Result<VideoMetadata> {
fps,
duration,
device_name: None,
+ name: Some(video_path.to_string()),
})
}
@@ -464,6 +465,7 @@ pub struct VideoMetadata {
pub fps: f64,
pub duration: f64,
pub device_name: Option<String>,
+ pub name: Option<String>,
}
#[derive(Debug, Deserialize)]
@@ -483,6 +485,7 @@ pub struct VideoMetadataOverride {
pub fps: Option<f64>,
pub duration: Option<f64>,
pub device_name: Option<String>,
+ pub name: Option<String>,
}
impl VideoMetadataOverride {
@@ -499,5 +502,8 @@ impl VideoMetadataOverride {
if let Some(ref device_name) = self.device_name {
metadata.device_name = Some(device_name.clone());
}
+ if let Some(ref name) = self.name {
+ metadata.name = Some(name.clone());
+ }
}
}
diff --git a/screenpipe-server/tests/db.rs b/screenpipe-server/tests/db.rs
index 4f5c6dd7d..9a6fc0e54 100644
--- a/screenpipe-server/tests/db.rs
+++ b/screenpipe-server/tests/db.rs
@@ -49,6 +49,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -91,6 +92,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -109,6 +111,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -158,6 +161,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -176,6 +180,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -238,6 +243,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -256,6 +262,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -388,6 +395,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -408,6 +416,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -432,6 +441,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -451,6 +461,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -547,6 +558,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -570,6 +582,7 @@ mod tests {
None,
None,
None,
+ None,
)
.await
.unwrap();
@@ -897,4 +910,137 @@ mod tests {
assert_eq!(similar_speakers.len(), 1);
assert_eq!(similar_speakers[0].id, speaker2.id);
}
+
+ #[tokio::test]
+ async fn test_search_with_frame_name() {
+ let db = setup_test_db().await;
+
+ // Insert video chunk and frames
+ let _ = db
+ .insert_video_chunk("test_video.mp4", "test_device")
+ .await
+ .unwrap();
+
+ // Insert first frame with OCR
+ let frame_id1 = db.insert_frame("test_device", None).await.unwrap();
+ db.insert_ocr_text(
+ frame_id1,
+ "Hello from frame 1",
+ "",
+ "test_app",
+ "test_window",
+ Arc::new(OcrEngine::Tesseract),
+ false,
+ )
+ .await
+ .unwrap();
+
+ // Insert second frame with OCR
+ let frame_id2 = db.insert_frame("test_device", None).await.unwrap();
+ db.insert_ocr_text(
+ frame_id2,
+ "Hello from frame 2",
+ "",
+ "test_app",
+ "test_window",
+ Arc::new(OcrEngine::Tesseract),
+ false,
+ )
+ .await
+ .unwrap();
+
+ // Test searching OCR with frame_name filter
+ let results = db
+ .search(
+ "text:Hello",
+ ContentType::OCR,
+ 100,
+ 0,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ Some("test_video"),
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(
+ results.len(),
+ 2,
+ "Should find both frames with matching video path"
+ );
+
+ // Test searching OCR with non-matching frame_name
+ let results = db
+ .search(
+ "Hello",
+ ContentType::OCR,
+ 100,
+ 0,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ Some("non_existent"),
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(
+ results.len(),
+ 0,
+ "Should find no frames with non-matching path"
+ );
+
+ // Test searching All content with frame_name filter
+ let results = db
+ .search(
+ "Hello",
+ ContentType::All,
+ 100,
+ 0,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ Some("test_video"),
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(
+ results.len(),
+ 2,
+ "Should find both frames in All content search"
+ );
+
+ // Count results with frame_name filter
+ let count = db
+ .count_search_results(
+ "Hello",
+ ContentType::OCR,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(count, 2, "Should count both matching frames");
+ }
}
diff --git a/screenpipe-vision/bin/ui_monitor b/screenpipe-vision/bin/ui_monitor
index c18230ba8..602bde837 100755
Binary files a/screenpipe-vision/bin/ui_monitor and b/screenpipe-vision/bin/ui_monitor differ
diff --git a/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin b/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin
index c18230ba8..602bde837 100755
Binary files a/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin and b/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin differ