Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
There was a problem hiding this comment.
Pull request overview
This PR improves multi-valued field handling by separating user-facing and database delimiters, enhancing diff output readability, and refactoring color formatting logic. The change makes beet modify and field display more user-friendly by replacing the internal \␀ separator with ; for user input and output.
Changes:
DelimitedStringtype now uses;for formatting/user input and\␀for database serialization- Field diffs for list values display per-item changes with
+/-prefixes instead of string comparison - Color formatting refactored into
_colorize(raw ANSI) andcolorize(feature-gated wrapper)
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| beets/dbcore/types.py | Separated database delimiter (\␀) from user-facing delimiter (; ) in DelimitedString type |
| beets/ui/init.py | Added list-aware diff rendering, refactored colorize/colordiff functions |
| beets/library/models.py | Updated tmpl_first documentation to remove redundant info |
| docs/reference/pathformat.rst | Expanded %first function documentation with examples and clearer parameter descriptions |
| docs/reference/cli.rst | Added guidance for modifying multi-valued fields |
| docs/conf.py | Added semicolon_space RST substitution for consistent documentation |
| test/ui/test_field_diff.py | Added tests for multi-value field diff rendering |
| test/test_plugins.py | Updated test assertion for new delimiter format |
| test/test_library.py | Updated %first function tests to use appropriate field types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6387 +/- ##
==========================================
+ Coverage 69.13% 69.17% +0.03%
==========================================
Files 140 140
Lines 18684 18686 +2
Branches 3055 3053 -2
==========================================
+ Hits 12918 12926 +8
+ Misses 5119 5115 -4
+ Partials 647 645 -2
🚀 New features to boost your workflow:
|
748934b to
03114e1
Compare
|
@amogus07 I see you've given the PR a thumbs-up. Would you mind reviewing it as well? 😆 |
I'm not that familiar with these parts of the codebase, unfortunately... I'm just glad this is finally being addressed |
|
I will review and test this later today! |
03114e1 to
54a46bd
Compare
- Use '\␀' as the DB delimiter while formatting lists with '; ' for templates. - Update DelimitedString parsing to accept both separators: * '\␀' for the values from the DB * '; ' for the rest of parsed values (for example `beet modify genres="eletronic; jazz"`) - Refresh %first docs and tests to reflect multi-value field behavior.
54a46bd to
4699958
Compare
JOJ0
left a comment
There was a problem hiding this comment.
Damnit forgot to add my final message in my previous review: Overall many many thanks! Great stuff here!. When testing add-multiple-genres I had similar thoughts: We need to find a way to make delimiters passing more user friendly. This null character is only suitable for actual storing. Well done, great solution you provided here!
Also adding a tiny test idea here in this subseuqent review. Not sure. What do you say?
|
This failing test seems unrelated: https://github.com/beetbox/beets/actions/runs/22280727644/job/64450831853?pr=6387 |
|
Actually, I thinkw we'd also like to adjust Currently we have: album: RAVE SLUTZ
album_id: 11492
albumartist: Fallen Shrine & dj Christian NXC
albumstatus: Official
albumtype: album
albumtypes: album
artist: Fallen Shrine & dj Christian NXC
artist_sort: ''
artists: Fallen Shrine; dj Christian NXCWhile I imagine we'd instead like to have: album: RAVE SLUTZ
album_id: 11492
albumartist: Fallen Shrine & dj Christian NXC
albumstatus: Official
albumtype: album
albumtypes:
- album
artist: Fallen Shrine & dj Christian NXC
artist_sort: ''
artists:
- Fallen Shrine
- dj Christian NXC |
Hmm interesting idea, since it's yaml... Do this in a subsequent PR? For now it's good enough in my opinion. Played with edit before and didn't miss anything, but yeah would be a great and self-explanatory feature! |
Treat DelimitedString as a safe YAML-editable type in the edit plugin, allowing multi-valued fields to be edited as native lists.
d5abe35 to
edfe005
Compare
|
sure! edit! sorry was busy this weekend orherwise. good you included it! thanks! |
While working on #6367 I noticed that users are currently required to use our internal separator
\␀in order to edit multi-valued fields, for examplebeet modify artists='a\␀b'.Similarly, this separator is used in output, for example, reporting of field changes:
This PR replaces
\␀separator with;for input and formats changes in multi-valued fields clearly:Architecture-level changes
DelimitedStringnow separates concerns between:db_delimiter(to_sql)'; 'delimiter (format)parse)_field_diffdetects list values_multi_value_diffcomputes set-based added/removed entries and renders per-item diff lines_colorizecolorizeis now only the feature-flag/environment gatecolordiffis reduced to string diff highlighting logic, with redundant wrapper logic removedHigh-level impact
'; 'for user input/output, DB delimiter internally).+/-item-level changes instead of generic string diffs.%firstusage andbeet modifyexamples.