Skip to content

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
git-moss:mainfrom
douglas-carmichael:contents-export
Open

Contents dialog: export the list of the found presets and import it back to pick what to convert#336
douglas-carmichael wants to merge 4 commits into
git-moss:mainfrom
douglas-carmichael:contents-export

Conversation

@douglas-carmichael

@douglas-carmichael douglas-carmichael commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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:

Name,Category,Zones,Key Low,Key High,MIDI Low,MIDI High,Folder,File,Container,Index,Selected,Path
BELL PAD,Bell,6,C0,C5,24,84,Bass Library,EIII Vol1.iso,Bank 2,3,true,/Users/…/EIII Vol1.iso
"BASS, CLRNT",,4,C0,F3,24,65,Bass Library,EIII Vol1.iso,Bank 2,4,false,/Users/…/EIII Vol1.iso
  • The exported list is what the tree currently shows, in display order, so a search filter narrows the export as well.
  • The ticked state is one of the fields, so a selection is not lost by exporting.
  • The format follows the ending of the picked file; a file typed without an ending gets the ending of the format selected in the file dialog, since not every platform appends it.
  • A preset without zones writes empty key-range fields (CSV) and null (JSON).

Import List...

Reads such a list back in and ticks exactly the presets it selects.

  • A row selects its preset when its Selected field says so - true, x, 1, yes, in any capitalisation, because a spreadsheet writes TRUE and a person writes x.
  • A list without a Selected field 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.
  • A row is matched by its file plus the index of the preset inside of it, so two presets of the same name in different banks stay apart, and a library which moved to another folder is still found by its file name. A row which carries only a name selects every preset of that name, which makes a hand-written list work.
  • CSV columns are looked up through the header line, so a list may be reordered or reduced to 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).
  • Rows which match nothing are counted and reported in the status line instead of stopping the import.

Notes

  • The column names and JSON attribute names are deliberately not translated - they are read by other applications and must not depend on the language of the user interface.
  • New ui/ContentsExporter and ui/ContentsImporter; the importer uses the Jackson which is already a dependency, the exporter formats CSV/JSON directly (RFC 4180 quoting, full JSON escaping).
  • ContentsEntry gained getLowestKey ()/getHighestKey () and its formatNote is public now, so the key range can be written both as note names and as MIDI note numbers.
  • ContentsDialog takes the BasicConfig, so both dialogs start in - and remember - the last used folder like the other file dialogs, and its auditionLabel is renamed to statusLabel since 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.

…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.
@douglas-carmichael douglas-carmichael changed the title Contents dialog: export the list of the found presets as a CSV or JSON file Contents dialog: export the list of the found presets and import it back to pick what to convert Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant