feat: add --preview / -p flag for content preview#21
Open
hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
Open
feat: add --preview / -p flag for content preview#21hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
Conversation
Audio files were previously skipped as unreadable binaries. This adds: - `is_audio()` detection via magic bytes (ID3, RIFF/WAVE, fLaC, OggS, ADTS, M4A ftyp box) with extension fallback - Audio metadata extraction via `ffprobe`: title, artist, album, genre, year, duration, bitrate, codec, sample rate - `build_user_content()` audio mode passes rich metadata as text context so the LLM can suggest a name based on embedded tags - 13 new bats tests covering detection, metadata, and end-to-end naming - README updated with audio formats and ffprobe optional dependency Closes marksverdhei#19
Closes marksverdhei#6 Before the hat animation runs, --preview prints a content snippet to stderr so you know what the file contains without opening it: - Text files: first 8 lines + total line count - Audio files: title, artist, album, duration from ffprobe tags - Images: dimensions, colour mode, key EXIF fields (Make, Model, DateTime) The preview goes to stderr only, so stdout output (the suggested name) is unaffected for scripting. Adds 6 new bats tests (44 total). Example output: ── preview: interview-recording.mp3 ── Title: Q3 Planning Call Artist: Zoom Recording Duration: 42:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #6
Adds
--preview/-pflag that prints a content snippet to stderr before the hat animation, so you can see what the file contains at a glance:Text files — first 8 lines + total line count:
Audio files — ID3/FLAC/OGG tags via ffprobe:
Images — dimensions, colour mode, key EXIF fields:
Preview output is stderr-only — stdout (the suggested name) is unchanged for scripting. Works alongside
--quiet,--batch, and--dry-run.Test plan
bats test.sh— 44/44 tests pass (6 new preview tests)hat --preview --dry-run some-file.txt