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

fix: speaker dates showing 12/31/1969 (unix epoch)

Louis Beaumont14181f519713
diff --git a/apps/screenpipe-app-tauri/components/settings/speakers-section.tsx b/apps/screenpipe-app-tauri/components/settings/speakers-section.tsx
index 88b9de42e..4228584ab 100644
--- a/apps/screenpipe-app-tauri/components/settings/speakers-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/speakers-section.tsx
@@ -40,6 +40,7 @@ interface AudioSample {
transcript: string;
start_time: number;
end_time: number;
+ timestamp?: number;
}
interface Speaker {
@@ -69,6 +70,7 @@ function parseSamples(metadata: string): AudioSample[] {
}
function formatTimeAgo(timestamp: number): string {
+ if (!timestamp) return "";
const now = Date.now() / 1000;
const diff = now - timestamp;
if (diff < 60) return "just now";
@@ -81,7 +83,7 @@ function formatTimeAgo(timestamp: number): string {
function getLatestSampleTime(speaker: Speaker): number {
const samples = parseSamples(speaker.metadata);
if (samples.length === 0) return 0;
- return Math.max(...samples.map((s) => s.end_time));
+ return Math.max(...samples.map((s) => s.timestamp || 0));
}
function AudioClip({
@@ -594,9 +596,9 @@ function SpeakerDetail({
<span className="flex-1 truncate text-muted-foreground">
&ldquo;{s.transcript}&rdquo;
</span>
- {s.end_time > 0 && (
+ {s.timestamp && s.timestamp > 0 && (
<span className="text-[10px] text-muted-foreground shrink-0">
- {formatTimeAgo(s.end_time)}
+ {formatTimeAgo(s.timestamp)}
</span>
)}
</div>
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index 1119f1f75..8820f7930 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -4140,7 +4140,8 @@ impl DatabaseManager {
ac.file_path,
at.transcription,
at.start_time,
- at.end_time
+ at.end_time,
+ CAST(unixepoch(at.timestamp) AS INTEGER) as abs_timestamp
FROM speakers s
JOIN audio_transcriptions at ON s.id = at.speaker_id
JOIN audio_chunks ac ON at.audio_chunk_id = ac.id
@@ -4178,7 +4179,8 @@ impl DatabaseManager {
'path', rap.file_path,
'transcript', rap.transcription,
'start_time', rap.start_time,
- 'end_time', rap.end_time
+ 'end_time', rap.end_time,
+ 'timestamp', rap.abs_timestamp
)
))
ELSE json_patch(
@@ -4188,7 +4190,8 @@ impl DatabaseManager {
'path', rap.file_path,
'transcript', rap.transcription,
'start_time', rap.start_time,
- 'end_time', rap.end_time
+ 'end_time', rap.end_time,
+ 'timestamp', rap.abs_timestamp
)
))
)
@@ -4271,7 +4274,8 @@ impl DatabaseManager {
ac.file_path,
at2.transcription,
at2.start_time,
- at2.end_time
+ at2.end_time,
+ CAST(unixepoch(at2.timestamp) AS INTEGER) as abs_timestamp
FROM NamedSpeakers ns
JOIN audio_transcriptions at2 ON at2.speaker_id IN (
SELECT s2.id FROM speakers s2 WHERE s2.name = ns.name AND s2.hallucination = 0
@@ -4297,7 +4301,8 @@ impl DatabaseManager {
'path', rap.file_path,
'transcript', rap.transcription,
'start_time', rap.start_time,
- 'end_time', rap.end_time
+ 'end_time', rap.end_time,
+ 'timestamp', rap.abs_timestamp
)
))
END as metadata
@@ -5211,7 +5216,8 @@ impl DatabaseManager {
ac.file_path,
at.transcription,
at.start_time,
- at.end_time
+ at.end_time,
+ CAST(unixepoch(at.timestamp) AS INTEGER) as abs_timestamp
FROM speakers s
JOIN audio_transcriptions at ON s.id = at.speaker_id
JOIN audio_chunks ac ON at.audio_chunk_id = ac.id
@@ -5237,7 +5243,8 @@ impl DatabaseManager {
'path', rap.file_path,
'transcript', rap.transcription,
'start_time', rap.start_time,
- 'end_time', rap.end_time
+ 'end_time', rap.end_time,
+ 'timestamp', rap.abs_timestamp
)))
ELSE json_patch(
json(s.metadata),
@@ -5245,7 +5252,8 @@ impl DatabaseManager {
'path', rap.file_path,
'transcript', rap.transcription,
'start_time', rap.start_time,
- 'end_time', rap.end_time
+ 'end_time', rap.end_time,
+ 'timestamp', rap.abs_timestamp
)))
)
END as metadata