feat(captions): add list_system_fonts command with fc-list + fallback

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-22 10:31:30 -04:00
parent cc0ca95846
commit a6277f0aa5
3 changed files with 209 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
import { invoke } from '@tauri-apps/api/core';
import { invoke, Channel } from '@tauri-apps/api/core';
export interface ThumbnailSpritesheet {
filePath: string;
@@ -10,15 +10,33 @@ export interface ThumbnailSpritesheet {
intervalSeconds: number;
}
export interface WaveformTiers {
/** ~2,000 peaks — overview for full-duration view */
tier0: number[];
/** ~10,000 peaks — moderate zoom */
tier1: number[];
/** All extracted peaks — deep zoom */
tier2: number[];
}
export async function extractKeyframes(filePath: string): Promise<number[]> {
return invoke<number[]>('extract_keyframes', { filePath });
}
export async function extractWaveform(
export async function extractWaveformTiers(
filePath: string,
sampleCount: number
): Promise<number[]> {
return invoke<number[]>('extract_waveform', { filePath, sampleCount });
duration: number,
onProgress?: (pct: number) => void
): Promise<WaveformTiers> {
const channel = new Channel<number>();
if (onProgress) {
channel.onmessage = onProgress;
}
return invoke<WaveformTiers>('extract_waveform_tiers', {
filePath,
duration,
onProgress: channel,
});
}
export async function extractThumbnails(
@@ -34,3 +52,13 @@ export async function extractThumbnails(
export async function cleanupThumbnails(paths: string[]): Promise<void> {
return invoke<void>('cleanup_thumbnails', { paths });
}
export async function checkEmbeddedSubtitles(
filePath: string
): Promise<string | null> {
return invoke<string | null>('check_embedded_subtitles', { filePath });
}
export async function listSystemFonts(): Promise<string[]> {
return invoke<string[]>('list_system_fonts');
}