Repository navigation
feat: plugins in the player, and analyzer fields in filters and sorts - #31
Merged
Merged
Conversation
…their params, answers in a panel, and their logs in the messages
…ns menu, planned in the background, confirmed with the plugin's summary and warnings, and undone like any edit
…ayer's search take sound.bpm:>120 and -sound.bpm, and the player runs analyzers from the palette and shows their fields as columns it remembers
…set and saving only what changed
…lan no longer takes for gone
…a form for their options, what they'd write shown first and overwriting asked about
… so the error is checked on Windows too
# Conflicts: # crates/locallibrary/src/fields/tests.rs
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.
What and why
The player hosts plugins through the same
crate::plugins::host()the CLI and sidecar use. Everything is drawn from the manifests, with no code for any one plugin. Analyzers' fields also become somethingtracks --filter,tracks --sortandtracks.querycan name, since the player's columns and search box needed that from core anyway.Added, in the player (
apps/locallibrary/src/tui/)::) and at the end of a drive'semenu in the Drives view, labelled by title with the plugin's name beside them. Operations also end the actions menu (e,edits::Action::Plugin). An entry that can't run says why: no drive open, or a folder opened by path instead of a drive plugged in (offered,plugin_items). They dispatch through newAct::Plugin,Act::Analyze,Act::FieldColumn,Act::PluginSettingsandAct::Exportvariants (keymap), none of them bound to a key.Form, drawn bydraw_form). Switches and short enums are picked with←→orspace, lists take commas, and paths may start with~. Values are parsed with the CLI'splugins::paramsand checked against the schema on the field at fault. A list of tracks starts as the marked or selected ones, and a command without params skips the form.escstops one. AViewanswer shows in the report panel, and a plain value as a message (show_answer). Tables keep their columns aligned using newTone::Columns/Tone::Rowlines, which are clipped instead of wrapped.plugin_cmd::view::tableandpairsare pulled out so the CLI and the player draw tables and key-value lists the same way.u) like any edit.analyze). "show the sound.bpm column" toggles aCol::Fieldcolumn, placed before tempo, key and time (with_fields) and saved intui.json(Saved.field_columns). Its values are read in the background (read_fields,Msg::Fields) the first time a column, filter or sort needs them. Clicking the header sorts by it, with tracks lacking a value always last, and the search box takessound.bpm:>120.plugin_settings).entersaves only what changed, and an emptied field goes back to its default.~/Music/and named after the drive, plus the format's options (plugin_export). The marked playlists are exported when there are some, as with rekordbox XML. The plan is a dry run off the UI thread (plan_export), shown likeexport --dry-run(export_lines) and confirmed as "Write N files?", or "Overwrite N files?" when some exist already.export_cmd::FILES_SHOWNandaboutare shared with the CLI's listing.!) while the player owns the terminal, throughplugins::log_toandMsg::Log, and back to stderr when it exits.Added, in core, the CLI and the sidecar:
PLUGIN.FIELD(Cond::Plugin). A number matches to the precision typed (128is 127.5 to 128.5), text matches whole words, and a boolean matchestrue/false. A field no installed analyzer declares, or a value its type can't hold, is refused. Sorts take-sound.bpmthroughparse_sort_withandsort_tracks_with.SortField::Fieldholds an internedFieldNamesoSortKeystaysCopy.fields::TrackValuesholds a library's values by track andPLUGIN.FIELD, read from afields::Source(store, analyzers, declared fields).Plugins::fieldslists what the installed analyzers declare.api::tracks_query_withtakes that source, andapi::filter_contexttakes the values.locallibrary tracksand the sidecar'stracks.querypass the installed analyzers throughplugins::Installed;collectionpasses none.Changed:
Touchedpath now records whether it existed at planning time, soPlanned::checkstops reporting a folder that wasn't there yet as gone. It reports one that has appeared since as stale.locallibrarybinary cargo builds next to them, since the test harness can't serve one.player.md(the palette, menus, form, analyzers, columns, settings, exports),plugins.md,editing.md(the filter table and sort orders),other-software.md(exporting from the player), andtracks --help/--sort's help. CHANGELOG's plugins entry covers the player and the new filters.How it was tested
The player's screens are covered by render tests in
tui/screens.rs(plugins,plugins_fields,plugins_settings,plugins_exports), using the echo plugin the tests register (app::testing::echo_plugin).tui/plugins/tests.rscovers the palette and menu entries, commands and their panels, operations planned, cancelled withesc, confirmed, applied and undone, analyzers filling columns, sorting and the search box, settings, and exports planned, confirmed, overwritten, refused onto a drive and limited to the marked playlists.tui/form/tests.rscovers the form, including hegel properties over its keys and numbers;tui/ui/tests.rscovers column placement and value formatting. In core,query/tests.rs(with a hegel property),fields/tests.rsandop/tests.rscover filters, sorts, values and the missing-folder check.apps/locallibrary/tests/it/plugins.rsaddstracks_are_filtered_and_sorted_by_what_analyzers_worked_outandplugins_formats_make_the_folders_they_write_into.Ran the full workspace checks locally on the branch:
cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warningsandcargo nextest run --workspace --locked.Checklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too, for a sidecar change)