convert: playlist feature: Better relative path gen

Use Item.destination method for generation of relative paths to media
files in playlist. The fragment keyword enables returning the path as
unicode instead of bytes, let's keep that in mind.
This commit is contained in:
J0J0 T 2022-07-06 08:36:32 +02:00 committed by J0J0 Todos
parent 16e25bb61b
commit c0b1bc9867

View file

@ -304,8 +304,10 @@ class ConvertPlugin(BeetsPlugin):
# media file paths to be unicode. Additionally we use relative
# paths to ensure readability of the playlist on remote
# computers.
dest_relative = util.displayable_path(dest).replace(
util.displayable_path(dest_dir) + os.sep, ""
dest_relative = item.destination(
basedir=dest_dir,
path_formats=path_formats,
fragment=True
)
with open(playlist, "a") as playlist_file:
playlist_file.write(dest_relative + "\n")