summaryrefslogtreecommitdiffstats
path: root/beets/library.py
diff options
context:
space:
mode:
Diffstat (limited to 'beets/library.py')
-rw-r--r--beets/library.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/beets/library.py b/beets/library.py
index 367b184ef..bb954237c 100644
--- a/beets/library.py
+++ b/beets/library.py
@@ -1042,12 +1042,12 @@ class Item(LibModel):
def destination(
self,
- fragment=False,
+ relative_to_libdir=False,
basedir=None,
platform=None,
path_formats=None,
replacements=None,
- ):
+ ) -> bytes:
"""Return the path in the library directory designated for the
item (i.e., where the file ought to be).
@@ -1104,12 +1104,11 @@ class Item(LibModel):
# When zero, try to determine from filesystem.
maxlen = util.max_filename_length(self._db.directory)
- subpath, fellback = util.legalize_path(
+ lib_path_str, fellback = util.legalize_path(
subpath,
replacements,
maxlen,
os.path.splitext(self.path)[1],
- fragment,
)
if fellback:
# Print an error message if legalization fell back to
@@ -1120,11 +1119,12 @@ class Item(LibModel):
"the filename.",
subpath,
)
+ lib_path_bytes = lib_path_str.encode()
- if fragment:
- return util.as_string(subpath)
- else:
- return normpath(os.path.join(basedir, subpath))
+ if relative_to_libdir:
+ return lib_path_bytes
+
+ return normpath(os.path.join(basedir, lib_path_bytes))
class Album(LibModel):