Doc rewording for #1330

This commit is contained in:
Adrian Sampson 2015-03-01 17:09:36 -08:00
parent e14f28fdda
commit eec8d5d2be
3 changed files with 14 additions and 7 deletions

View file

@ -45,8 +45,9 @@ log = logging.getLogger('beets')
class PathQuery(dbcore.FieldQuery):
"""A query that matches all items under a given path.
On Windows paths are case-insensitive by default, contrarly to UNIX
platforms.
Matching can either base case-sensitive or case-sensitive. By
default, the behavior depends on the OS: case-insensitive on Windows
and case-sensitive otherwise.
"""
escape_re = re.compile(r'[\\_%]')
@ -55,15 +56,21 @@ class PathQuery(dbcore.FieldQuery):
_is_windows = platform.system() == 'Windows'
def __init__(self, field, pattern, fast=True, case_sensitive=None):
"""Create a path query.
`case_sensitive` can be a bool or `None`, indicating that the
behavior should depend on the platform (the default).
"""
super(PathQuery, self).__init__(field, pattern, fast)
# By default, the case sensitivity depends on the platform.
if case_sensitive is None:
# setting this value as the default one would make it un-patchable
# and therefore un-testable
case_sensitive = not self._is_windows
self.case_sensitive = case_sensitive
# Use a normalized-case pattern for case-insensitive matches.
if not case_sensitive:
pattern = pattern.lower()
self.case_sensitive = case_sensitive
# Match the path as a single file.
self.file_path = util.bytestring_path(util.normpath(pattern))

View file

@ -76,7 +76,7 @@ Fixes:
* :doc:`/plugins/replaygain`: Stop applying replaygain directly to source files
when using the mp3gain backend. :bug:`1316`
* Path queries are case-sensitive on UNIX OSes. :bug:`1165`
* Path queries are case-sensitive on non-Windows OSes. :bug:`1165`
* :doc:`/plugins/lyrics`: Silence a warning about insecure requests in the new
MusixMatch backend. :bug:`1204`
* Fix a crash when ``beet`` is invoked without arguments. :bug:`1205`

View file

@ -184,7 +184,7 @@ Note that this only matches items that are *already in your library*, so a path
query won't necessarily find *all* the audio files in a directory---just the
ones you've already added to your beets library.
Such queries are case-sensitive on UNIX and case-insensitive on Microsoft
Path queries are case-sensitive on most platforms but case-insensitive on
Windows.
.. _query-sort: