Contents dialog: export the list of the found presets and import it back to pick what to convert - #336
Open
douglas-carmichael wants to merge 4 commits into
Open
Conversation
…N file The new 'Export List...' button writes the presets which are currently listed - not the presets themselves - to a CSV or JSON file: name, category, number of zones, key range as note names and as MIDI note numbers, folder, file, containers, index inside of the file and whether the preset is ticked. This gives an inventory of a disk image, a bank or a preset folder which can be read in a spreadsheet or by a script. The search filter applies to the written list as well and the file format follows the ending of the picked file; a file without an ending gets the one of the format which is selected in the file dialog.
'Import List...' reads a written list back in and ticks exactly the
presets which it selects, so the presets to convert can be picked in
another application: export the list, tick what should be converted in
e.g. a spreadsheet, save it as CSV again and import it.
A row selects its preset when its 'Selected' field says so ('true', 'x',
'1' or 'yes'); a list which has no such field selects every preset it
contains, so deleting the rows which should not be converted works as
well. Presets which the list does not mention are not ticked.
A row is matched by its file and the index of the preset inside of it,
so presets of the same name in different banks stay apart and a library
which was moved to another folder is still found by its file name; a row
which has only a name selects every preset of that name. Reading a CSV
file goes through the header line, so its columns may be reordered or
reduced, and semicolon or tabulator separated files - as a spreadsheet
writes them in some countries - are read as well. Rows which match
nothing are reported instead of stopping the import.
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.
The Contents dialog knows a lot about a source that is available nowhere else: for a disk image or a bank it is the only place where the preset names, their zone counts, key ranges and categories can be seen at all. For a large library that list is exactly what you want before converting - to decide what to convert, to check a library against a paper index, or to keep a record of what an old floppy or CD actually contains. Right now it can only be read on screen, a few dozen lines at a time (my Logic EXS24 folder lists 1031 presets), and the presets to convert have to be ticked one by one in the tree.
Two buttons close that gap, and together they make a workflow which the tree alone cannot offer: filling a hardware sampler from a big library - export the list, decide in a spreadsheet which sounds go on the card, import the result and convert exactly those.
Export List...
Writes the list - the list, not the presets - as CSV or JSON:
null(JSON).Import List...
Reads such a list back in and ticks exactly the presets it selects.
Selectedfield says so -true,x,1,yes, in any capitalisation, because a spreadsheet writesTRUEand a person writesx.Selectedfield selects every preset it contains, so deleting the rows you do not want is a valid way to narrow the list down. Presets the list does not mention are not ticked.Name/Index/File/Selected- which is what comes back out of a spreadsheet. Semicolon and tabulator separated files are read too (a spreadsheet writes semicolons in the countries which use the comma as decimal separator).Notes
ui/ContentsExporterandui/ContentsImporter; the importer uses the Jackson which is already a dependency, the exporter formats CSV/JSON directly (RFC 4180 quoting, full JSON escaping).ContentsEntrygainedgetLowestKey ()/getHighestKey ()and itsformatNoteis public now, so the key range can be written both as note names and as MIDI note numbers.ContentsDialogtakes theBasicConfig, so both dialogs start in - and remember - the last used folder like the other file dialogs, and itsauditionLabelis renamed tostatusLabelsince it now reports export and import results as well.Verified with a round-trip harness over 13 cases: CSV and JSON full round trips, a re-export from a spreadsheet (quoted fields, CRLF,
TRUE/FALSE), a semicolon separated list, a name-only list, unmatched rows, a moved library, hand-edited JSON, and two presets of the same name in different images. Compiles with JDK 25/26.The two buttons sit in the bottom row next to Play. If you would rather have them in the top row next to Select all/Select none, say so and I will move them.