One copy plan that both the CLI and the browser render #20
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
wokoman/ironpod!20
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/copy-plan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
One answer to "what will this copy do", produced by the copy module and rendered by whoever asked — the command line checks it, the browser turns it into a confirmation.
Both callers needed the same four facts before a copy starts: which files were found, how many need converting, whether ffmpeg is available, and whether the copy should be refused outright. Neither asked for them; each assembled them by hand from three separate helpers, and the predictable happened — the browser's version came out missing the refusal, which was #6.
The plan and the dry run stay two things. The ticket left that open, so here is the reasoning. They answer different questions from different inputs: a plan is about the batch and is deliberately computable without a
Database, which is the whole point — it is what lets a copy be refused before the device is opened. The dry run is about each individual file and needs the database to know what is already there. Merging them would mean opening the device before the refusal could fire, undoing #6. The dry run is untouched.The walker moves into the copy module with them, since the plan is now its only caller. #10 deliberately left it in
cli.rsfor this ticket to place, rather than moving it twice. Its tests move with it.Progress reporting is one callback taking a
Step— scanning, or reading tags — rather than two separate loops each with their own callback. Both steps are slow for the same reason and neither is predictable: the walk is IO-bound, and deciding what needs converting opens every.m4a, since ALAC and AAC share a container. The browser matches on the step to redraw every eighth file; the command line ignores it.One behaviour change worth naming: the command line used to short-circuit its "does anything need converting" check with
any, and now gets a full count from the plan. On a batch of.m4afiles that is more work, since each one has to be opened to tell ALAC from AAC. It buys the single answer both front ends share, and the count is what the browser's confirmation has always needed.The plan is asserted with no device attached — a directory of an MP3, a FLAC and a JPEG plans as two files, one converting, the image excluded, with the refusal following whether ffmpeg is actually present and the tag-reading step reported with the right total.
Verified on the real device end to end: dry run, then copying two throwaway tracks, listing them, removing them, and confirming the track count returned to 6307 with nothing left behind.
iTunesDB,iTunesDB.extandSysInfowere backed up first. Theitdb_splr_validatewarnings in the output are the known pre-existing smart-playlist quirk on this device, recorded inSPEC.md.68 unit tests pass,
cargo clippy --all-targetsclean.Closes #8.