feat: Phase N power-user surface (terminal, palette, per-item, sort, url-templates)
- Built-in yt-dlp terminal: src/main/terminal.ts streams raw yt-dlp runs (binary fixed, gated on customCommandEnabled), new TerminalView + sidebar tab - Command palette (Ctrl/Cmd+K), portal-free CommandPalette.tsx wired in App - Per-playlist-item editing: per-row video/audio toggle + All video/All audio batch; addPlaylist enqueues via addMany with per-item kind - Weighted format sorting: DownloadOptions.formatSort -> raw -S (overrides codec) - URL-regex template auto-matching: CommandTemplate.urlPattern + selectExtraArgs matchesUrl, threaded through resolveExtraArgs; field in TemplateManager typecheck + test (192) + electron-vite build all clean. Roadmap: Phase N COMPLETE. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+39
-1
@@ -71,7 +71,12 @@ export const IpcChannels = {
|
||||
scheduledSyncGet: 'sources:scheduled-sync-get',
|
||||
scheduledSyncSet: 'sources:scheduled-sync-set',
|
||||
/** main → renderer push channel for live indexing progress */
|
||||
indexProgress: 'sources:index-progress'
|
||||
indexProgress: 'sources:index-progress',
|
||||
// --- Built-in yt-dlp terminal (Phase N) ---
|
||||
terminalRun: 'terminal:run',
|
||||
terminalCancel: 'terminal:cancel',
|
||||
/** main → renderer push channel for live terminal output lines */
|
||||
terminalOutput: 'terminal:output'
|
||||
} as const
|
||||
|
||||
/** Sentinel format id meaning "let yt-dlp pick the best video+audio". */
|
||||
@@ -147,6 +152,13 @@ export interface DownloadOptions {
|
||||
videoContainer: VideoContainer
|
||||
/** preferred video codec (sort tiebreaker, not a hard filter) */
|
||||
preferredVideoCodec: VideoCodecPref
|
||||
/**
|
||||
* Advanced: a raw yt-dlp `-S` format-sort string (e.g. 'res:1080,vcodec:av01,size').
|
||||
* When non-empty it replaces the codec-derived sort, letting power users rank
|
||||
* resolution / codec / container / size by weighted priority. Empty = use the
|
||||
* preferredVideoCodec tiebreaker.
|
||||
*/
|
||||
formatSort: string
|
||||
/** download + embed subtitles into video */
|
||||
embedSubtitles: boolean
|
||||
/** comma-separated yt-dlp sub-lang selectors, e.g. 'en' or 'en.*,es' */
|
||||
@@ -179,6 +191,7 @@ export const DEFAULT_DOWNLOAD_OPTIONS: DownloadOptions = {
|
||||
audioFormat: 'mp3',
|
||||
videoContainer: 'mp4',
|
||||
preferredVideoCodec: 'any',
|
||||
formatSort: '',
|
||||
embedSubtitles: false,
|
||||
subtitleLanguages: 'en',
|
||||
autoSubtitles: false,
|
||||
@@ -509,6 +522,13 @@ export interface CommandTemplate {
|
||||
id: string
|
||||
name: string
|
||||
args: string
|
||||
/**
|
||||
* Optional regex (matched case-insensitively against the download URL). When
|
||||
* set and custom commands are enabled, this template auto-applies to any URL it
|
||||
* matches — taking precedence over the global defaultTemplateId. Empty/undefined
|
||||
* means the template is only applied when explicitly chosen as the default.
|
||||
*/
|
||||
urlPattern?: string
|
||||
}
|
||||
|
||||
/** Result of building the exact yt-dlp command line for the current form state, without running it. */
|
||||
@@ -671,3 +691,21 @@ export interface ScheduledSyncStatus {
|
||||
enabled: boolean
|
||||
error?: string
|
||||
}
|
||||
|
||||
// --- Built-in yt-dlp terminal (Phase N) -------------------------------------
|
||||
// A power-user console that runs the bundled yt-dlp with raw, user-typed args
|
||||
// and streams its output. The binary is fixed to yt-dlp (never arbitrary exes),
|
||||
// and the feature is gated on the same customCommandEnabled consent flag as the
|
||||
// per-download extra args (extra args can run code via --exec — audit F2).
|
||||
|
||||
/** Live output pushed on IpcChannels.terminalOutput while a terminal command runs. */
|
||||
export type TerminalEvent =
|
||||
| { type: 'output'; id: string; line: string; stream: 'stdout' | 'stderr' }
|
||||
| { type: 'done'; id: string; code: number | null }
|
||||
| { type: 'error'; id: string; error: string }
|
||||
|
||||
/** Result of starting a terminal command (pre-spawn validation only). */
|
||||
export interface TerminalRunResult {
|
||||
ok: boolean
|
||||
error?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user