feat: add duration field to dataset entries and update related components for display and processing

This commit is contained in:
averel10
2026-03-13 11:11:16 +01:00
parent 03118c468a
commit 412d0f1cd0
7 changed files with 558 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ export async function downloadFilteredEntries(
const row = [
`"${entry.externalId}"`,
entry.fileName,
'',
entry.durationMs?.toString() || '',
entry.utteranceId || '',
`"${(entry.utteranceText || '').replace(/"/g, '""')}"`,
entry.speakerId,

View File

@@ -136,6 +136,7 @@ export async function processDatasetEntries(
fileName: relativePath,
dialect: row.dialect,
iteration: parseInt(row.iteration, 10),
durationMs: row.duration_ms ? parseInt(row.duration_ms, 10) : undefined,
});
}
}

View File

@@ -117,6 +117,11 @@ export default async function DatasetEntryPage({ params }: DatasetEntryPageProps
<AudioPlayer datasetId={datasetIdNum} fileName={entry.fileName} externalId={entry.externalId} />
</div>
<div className="bg-white border border-gray-200 p-4 rounded-lg">
<p className="text-sm text-gray-600 mb-1">Duration (ms)</p>
<p className="text-lg font-semibold">{entry.durationMs?.toLocaleString() || '-'}</p>
</div>
<div className="bg-white border border-gray-200 p-4 rounded-lg">
<p className="text-sm text-gray-600 mb-1">Created</p>
<p className="text-lg font-semibold">

View File

@@ -15,6 +15,7 @@ export const dataset_entry = sqliteTable('dataset_entry', {
fileName: text('file_name').notNull(),
dialect: text('dialect').notNull(),
iteration: integer('iteration').notNull(),
durationMs: integer('duration_ms'),
createdAt: integer('created_at', { mode: 'timestamp' })
.notNull()
.default(sql`(unixepoch())`),