Added warning message and paragraph about replacements/max length interaction in documentation.

This commit is contained in:
Ben Ockmore 2015-07-07 17:46:42 +01:00
parent b479982043
commit 1f1e0f7240
3 changed files with 16 additions and 3 deletions

View file

@ -795,8 +795,14 @@ class Item(LibModel):
# When zero, try to determine from filesystem.
maxlen = util.max_filename_length(self._db.directory)
subpath = util.legalize_path(subpath, self._db.replacements, maxlen,
os.path.splitext(self.path)[1], fragment)
subpath, fellback = util.legalize_path(
subpath, self._db.replacements, maxlen,
os.path.splitext(self.path)[1], fragment
)
# Print an error message if legalize fell back to default replacements
if fellback:
log.warning(u'fell back to default replacements when naming file')
if fragment:
return subpath

View file

@ -597,7 +597,9 @@ def legalize_path(path, replacements, length, extension, fragment):
first_stage_path, None, length, extension, fragment
)
return second_stage_path
return second_stage_path, True
else:
return second_stage_path, False
def str2bool(value):

View file

@ -119,6 +119,11 @@ compatibility with Windows-influenced network filesystems like Samba).
Trailing dots and trailing whitespace, which can cause problems on Windows
clients, are also removed.
When replacements other than the defaults are used, it is possible that they
will increase the length of the path. In the scenario where this leads to a
conflict with the maximum filename length, the default replacements will be
used to resolve the conflict and beets will display a warning.
Note that paths might contain special characters such as typographical
quotes (``“”``). With the configuration above, those will not be
replaced as they don't match the typewriter quote (``"``). To also strip these