From 16e25bb61bd821fb28f602b3aca27f4ec3f5ee9a Mon Sep 17 00:00:00 2001 From: J0J0 T Date: Mon, 4 Jul 2022 16:14:33 +0200 Subject: [PATCH] convert: playlist feature: Fix relative paths pointing to media files in playlist. Also refine code comment and move to a better fitting place. --- beetsplug/convert.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 2680d3951..082124b8c 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -299,11 +299,16 @@ class ConvertPlugin(BeetsPlugin): "Appending to playlist file {0}", util.displayable_path(playlist) ) + # The classic m3u format doesn't support special characters in + # media file paths, thus we use the m3u8 format which requires + # 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, "" + ) with open(playlist, "a") as playlist_file: - # The classic m3u format doesn't support special characters - # in media file paths, thus we use the m3u8 format which - # requires media file paths to be unicode. - playlist_file.write(util.displayable_path(dest) + "\n") + playlist_file.write(dest_relative + "\n") # Ensure that only one thread tries to create directories at a # time. (The existence check is not atomic with the directory