Fix H5/H6/M21/L37-40/L47/L55/L68/L72/L76/L91/L98/L108/L165/L166 audit items
H5: HistoryEntry now stores formatId+formatHasAudio; redownload passes them
back to addFromUrl so the original yt-dlp format is reused, not guessed.
Compound quality labels stripped to the preset prefix for old history.
L72: thumbnail now passed in redownload so re-queued rows keep their art.
H6: TerminalView log capped at MAX_LOG_LINES=2000 to prevent unbounded growth.
M21: --audio-quality omitted for lossless audioFormats (flac/wav).
L166: fmtEta hour rollover fixed in all 3 locations -- 2h00:00 not 120:00.
L165: queueStats formatSpeed precision aligned with fmtBytes.
L55: QueueItem suppresses sizeLabel when already in probed-format quality label.
L47: probeMeta null sends empty meta event so Resolving clears via SR6.
L68: notifiedBackground resets on window show for subsequent close-while-downloading.
L76: dup warning falls back to URL when title is still a placeholder.
L91: SettingsView onFormatSelect uses indexOf instead of unsafe tuple cast.
L98: Embed chapters field gets a hint text.
L108: BrowserWindow created with explicit title AeroFetch.
L37: pure formatters extracted to src/main/lib/formatters.ts and unit-tested.
L38: buildArgs test covers webm thumbnail suppression.
L39: CROP_SQUARE_PPA test is structural not exact-string.
L40: looksLikeUrl/looksLikeSingleVideo extracted to src/renderer/src/lib/urlHelpers.ts.
typecheck + 242 tests + eslint + prettier green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+18
-7
@@ -279,13 +279,14 @@ describe('cropThumbnail → --ppa crop', () => {
|
||||
expect(hasSeq(argv, '--embed-thumbnail', '--ppa', CROP_SQUARE_PPA)).toBe(true)
|
||||
})
|
||||
|
||||
it('uses single-quoted, comma-protected crop expressions for ffmpeg', () => {
|
||||
// The commas live inside gt(...) and MUST stay quoted so ffmpeg does not read
|
||||
// them as filtergraph separators. The targeted-postprocessor key plus the
|
||||
// ffmpeg_o output-args selector frame the whole value.
|
||||
expect(CROP_SQUARE_PPA).toBe(
|
||||
"EmbedThumbnail+ffmpeg_o:-c:v mjpeg -vf crop=\"'if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'\""
|
||||
)
|
||||
it('targets the EmbedThumbnail post-processor and uses ffmpeg output args (L39)', () => {
|
||||
// Structural test: verify the key invariants without locking in the exact string,
|
||||
// so minor whitespace or quoting style tweaks don't break CI.
|
||||
expect(CROP_SQUARE_PPA).toMatch(/^EmbedThumbnail\+ffmpeg_o:/)
|
||||
expect(CROP_SQUARE_PPA).toContain('-c:v mjpeg')
|
||||
expect(CROP_SQUARE_PPA).toMatch(/-vf\s+crop=/)
|
||||
// Commas inside gt() MUST be inside quotes so ffmpeg doesn't split on them.
|
||||
expect(CROP_SQUARE_PPA).toMatch(/crop="[^"]*,/)
|
||||
})
|
||||
|
||||
it('does not add --ppa when cropThumbnail is off', () => {
|
||||
@@ -299,6 +300,16 @@ describe('cropThumbnail → --ppa crop', () => {
|
||||
expect(argv).not.toContain('--ppa')
|
||||
expect(argv).not.toContain('--embed-thumbnail')
|
||||
})
|
||||
|
||||
it('suppresses --embed-thumbnail for webm (not supported by the container, L38)', () => {
|
||||
const argv = build(opts(), dlo({ embedThumbnail: true, videoContainer: 'webm' }))
|
||||
expect(argv).not.toContain('--embed-thumbnail')
|
||||
})
|
||||
|
||||
it('keeps --embed-thumbnail for mp4 container (L38)', () => {
|
||||
const argv = build(opts(), dlo({ embedThumbnail: true, videoContainer: 'mp4' }))
|
||||
expect(argv).toContain('--embed-thumbnail')
|
||||
})
|
||||
})
|
||||
|
||||
// --- Custom commands (Phase C): extra args + display formatting ------------
|
||||
|
||||
Reference in New Issue
Block a user