This PR improves the regex detection used for the drive_sep_replace default.

This commit is contained in:
spaceage64 2026-03-06 16:45:59 +01:00
parent edbf737638
commit 7b26733e04
4 changed files with 11 additions and 8 deletions

View file

@ -159,8 +159,8 @@ class FormattedMapping(Mapping[str, str]):
sep_repl: str = beets.config["path_sep_replace"].as_str()
sep_drive: str = beets.config["drive_sep_replace"].as_str()
if re.match(r"^\w:", value):
value = re.sub(r"(?<=^\w):", sep_drive, value)
if re.match(r"^[a-zA-Z]:", value):
value = re.sub(r"(?<=[a-zA-Z]):", sep_drive, value)
for sep in (os.path.sep, os.path.altsep):
if sep:

View file

@ -60,6 +60,9 @@ Bug fixes
``duplicate_action`` config options were silently ignored for as-is imports.
- :doc:`/plugins/convert`: Fix extension substitution inside path of the
exported playlist.
- :ref:`replace`: Made ``drive_sep_replace`` regex logic more precise to prevent
edge-case mismatches (e.g., a song titled "1:00 AM" would incorrectly be
considered a Windows drive path).
For plugin developers
~~~~~~~~~~~~~~~~~~~~~

View file

@ -57,9 +57,9 @@ file. The available options mirror the command-line options:
- **delete**: Remove matched items from the library and from the disk. Default:
``no``
- **format**: A specific format with which to print every track or album. This
uses the same template syntax as beets' :doc:`path
formats</reference/pathformat>`. The usage is inspired by, and therefore
similar to, the :ref:`list <list-cmd>` command. Default: :ref:`format_item`
uses the same template syntax as beets' :doc:`path formats
</reference/pathformat>`. The usage is inspired by, and therefore similar to,
the :ref:`list <list-cmd>` command. Default: :ref:`format_item`
- **full**: List every track or album that has duplicates, not just the
duplicates themselves. Default: ``no``
- **keys**: Define in which track or album fields duplicates are to be searched.

View file

@ -29,10 +29,10 @@ searched in the playlist_dir and the ".m3u" extension is appended to the name:
$ beet ls playlist:anotherplaylist
A playlist query will use the paths found in the playlist file to match items in
the beets library. ``playlist:`` submits a regular beets :ref:`query<queries>`
similar to a :ref:`specific fields query<fieldsquery>`. If you want the list in
the beets library. ``playlist:`` submits a regular beets :ref:`query <queries>`
similar to a :ref:`specific fields query <fieldsquery>`. If you want the list in
any particular order, you can use the standard beets query syntax for
:ref:`sorting<query-sort>`:
:ref:`sorting <query-sort>`:
::