MilkDrop: import whole libraries from ZIP packs, folders and the machine (#574, part 2) - #607
Merged
Merged
Conversation
…e machine Two steps: a scan returns a summary (presets, textures, MB and what will be skipped) while the plan stays in the main process; nothing is copied until the user confirms. - Own ZIP reader: central directory only for the scan, ZIP64, stored and deflate entries, CRC checked, a hard output cap per entry, a compression-ratio limit, at most 200,000 entries, CP437 and UTF-8 names. Only an entry's file name is used, so it cannot write outside (zip-slip). - Scans take .milk files in nested folders, images in textures/sprites folders, and images next to the presets only when a preset samples them (listed apart in the summary, not counted into its size). .milk2, oversized files, encrypted entries and macOS leftovers are skipped and reported. Same name and same content is a duplicate. - Textures go into the app's own folder, looked up after the texture folder the user chose; a counter in the settings makes every engine reload its texture list after an import. - The pack's category folders become tags (#576) unless turned off. - Search This Computer: explicit roots, known install folders, then Downloads, Desktop, Music and Documents as the system reports them. Candidates are searched breadth first, so a huge folder no longer hides a small pack next to it, and counted in the remaining time. A library whose count did not finish is listed with "+" and scanned in full before the confirmation, so nothing is imported from a partial scan; a search that ran out of time says so. Refs #574, #560
…the page A web overlay opened before an import asked for its texture list again after it and loaded the imported texture from the server. The comments now say that only file lists stay in the main process: the source's own path goes to the panel as a tooltip. Refs #574
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.
Part 2 of 2 for #574: the importer. Part 1 (#606) made the store carry large libraries.
The MilkDrop panel gains 🗜 Import from ZIP Pack, 📁 Import from Folder and 🔎 Search This Computer. Every import has two steps. First, a scan shows the user what will be added: presets, textures, MB, and what will be skipped. Nothing is copied until the user confirms. The plan stays in the main process, and the page gets only a summary and a token.
What it does
What is taken:
.milkfiles in nested folders.texturesorspritesfolders.sampler_<name>. A preview picture beside each preset is not a texture. The summary lists these images separately instead of counting them into the size.Skipped and reported:
.milk2files (MilkDrop 3 compatibility: an Automatic / MilkDrop 2 / MilkDrop 3 mode #567).macOS
__MACOSXand AppleDouble leftovers, hidden folders andnode_modulesare not looked at.Duplicates: a preset with the same name and the same content is skipped. One with the same name but different content is imported.
ZIP reader: our own code.
Textures: copied into the app's own folder (
userData/milkdrop-textures).milkdropLibrary.textureRevmakes every engine reload its texture list after an import: windows, Spout/Syphon, the preview and the web overlay.Tags: the first folder below the pack's common prefix becomes a tag (MilkDrop: favourites, tags and search by author #576), unless it has a generic name. The user can turn this off.
Search This Computer:
app.getPath; OneDrive can move them, and Linux localizes their names).Measured
worms.jpginto the app's folder.worms.jpgwith no texture folder chosen.worms.jpgfrom the server when a preset needing it was chosen.npm test: 2081/2081.npm run smoke: PASS, and the user-data checksums were unchanged.process.platformset to Linux.Not done
.milk2(MilkDrop 3 compatibility: an Automatic / MilkDrop 2 / MilkDrop 3 mode #567).Tests
29 new tests:
57 of 57 mutations are caught.
Refs #574, #560