A date range query whose start lies after its end, such as
`beet ls added:2024..2020`, crashed with an uncaught ValueError
raised by DateInterval's endpoint-order check:
ValueError: start date 2024-01-01 00:00:00 is not before end date
2021-01-01 00:00:00
Only InvalidQueryArgumentValueError is converted into a user-facing
InvalidQueryError by Library._get_results, so the plain ValueError
escaped all the way up as a traceback.
Rather than reporting an error, accept the range and swap its two
endpoints, so `added:2024..2020` means the same as `added:2020..2024`.
The swap lives in `DateInterval.from_periods`, which is the only place
where the two user-supplied endpoints are still available as `Period`
objects. Swapping further down, in `DateInterval.__init__`, would swap
the already-derived datetimes, and those are derived asymmetrically:
the start contributes `Period.date` while the end contributes
`Period.open_right_endpoint()`. For `2024..2020` that would yield
[2021-01-01, 2024-01-01), which excludes both 2020 and 2024 -- not the
interval the user asked for. Swapping the periods first yields
[2020-01-01, 2025-01-01), which is exactly `2020..2024`.
`DateInterval.__init__` keeps raising ValueError, since it remains the
invariant guard for callers constructing an interval from datetimes
directly, where there is no notion of the order the user typed.
The swap only triggers when the interval would otherwise be empty, so
partially overlapping mixed-precision ranges that are valid today, such
as `2000-06..2000`, are unaffected. Genuinely malformed input such as
`added:notadate` still raises InvalidQueryArgumentValueError from
`Period.parse` as before.
Co-Authored-By: Claude <noreply@anthropic.com>
- Wrap new test_dbcore.py tests in TestModelTypeFallback class
- Add changelog entry for the modify -a multi-value field fix
- Document multi-valued field support for album modify in cli.rst
* official/master: (54 commits)
Require data_source in album_for_id and track_for_id functions
Invoke album_matched hook from AlbumMatch.__post_init__
Refactor match_by_id
Take data source into account when deciding duplicate candidates
Return album candidates from multiple sources when matching by IDs
Add a test to reproduce the issue
Move assignment tests to test/autotag/test_match.py
Pulled latest changelog and added my entry to 'Unreleased > Bug fixes' section.
Moved changelog note to top, under Unreleased.
This PR improves the regex detection used for the drive_sep_replace default.
This PR improves the regex detection used for the drive_sep_replace default.
refactor: Use deprecate_for_user for beatport/bpsync deprecation warnings
Fix docs: use single-line deprecated directive compatible with docstrfmt
Fix docs formatting for beatport and bpsync rst files
Deprecate beatport and bpsync plugins
Update changelog.rst
try to fix fish plugin
Make get_search_query_with_filters abstract
Document new methods
Document shared metadata search plugin workflow
...
* official/master: (180 commits)
feat(lastgenre): cleanup_existing
convert: generate playlist entries from effective output paths
Fix lint issues
Move changelog note under Unreleased section
Enable duplicate detection for as-is imports
Force slow queries for FuzzyPlugin
Add tests
Add changelog note
Match substrings fuzzily
Fix lint
Move test_autotag tests under test/autotag
Keep missing multi-value fields as None instead of empty list
Show that album genres are not applied to tracks
autotag: refactor autotag tests to use single comprehensive test
fix(lastgenre): Reset plugin config in fixtured tests
fix(fetchart): prevent deletion of configured fallback cover art
Move changelog note under unreleased section
Update changelog note
fix: ftintitle can handle a list of ampersanded artists
Fix symlink tests for macOS
...
Add documentation for the distance_weights configuration option in
the autotagger matching section. This includes all available fields
with their default values and an example of how to customize them.
Closes#6081
Signed-off-by: edvatar <88481784+toroleapinc@users.noreply.github.com>
- 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.