convert: playlist feature: Fix relative paths

pointing to media files in playlist. Also refine code comment and move
to a better fitting place.
This commit is contained in:
J0J0 T 2022-07-04 16:14:33 +02:00 committed by J0J0 Todos
parent fd8fe69738
commit 16e25bb61b

View file

@ -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