Add JSON Group Information Export (incremental to PR #2) #3
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.
Add JSON Group Information Export
This PR adds JSON export functionality for group metadata. When using Cullergrader in scripts or automated workflows, you don't always want to copy files to a new folder - sometimes you just need the grouping information so you can process the groups yourself for other purposes (archiving, custom filtering, integration with other tools, etc.).
Like PR #2, this was implemented with help from Claude Code.
Context
This builds on PR #2 (feature/add-cli-support). Review this after #2 is merged, since it extends the CLI with a new flag and adds a corresponding GUI feature.
What's New
Core Functionality
Added
exportGroupsJson()method toFileUtils.javathat generates a structured JSON file containing group metadata: total counts, thresholds used, and detailed per-group information including photo paths, timestamps, hashes, and similarity metrics. The JSON is pretty-printed using the existing GSON dependency.Parent directories are created automatically (matching the
--outputbehavior), so paths likeexport/data/groups.jsonwork without manual directory creation.CLI Extension
The CLI now accepts a
--json/-jflag that can be used three ways:--input photos --json groups.json(preview mode + metadata)--input photos --output best --json groups.json(files + metadata)--input photos --output best(files only, existing behavior)GUI Addition
The File menu now has "Export Group Information (JSON)" below the existing export option. Opens a file chooser with JSON filter, defaults to
groups.json, and uses the current threshold values from the spinners. Automatically appends.jsonextension if missing and validates that groups exist before exporting.Notes on the JSON Structure
The exported similarity metrics reflect how the grouping algorithm works - each photo's
deltaTimeSecondsandsimilarityPercentare relative to the previous photo in the sequence, not to all photos in the group. This is why you might see different similarity percentages within the same group (the first photo shows similarity to the last photo of the previous group, which is why it started a new group).