From 4e07a5d5cde6ee70234c03c034fe30013713bad2 Mon Sep 17 00:00:00 2001 From: Melvyn Harbour Date: Mon, 8 Jul 2024 13:58:48 +0100 Subject: [PATCH] Replace windows separators in m3u (#1471) --- music_assistant/server/helpers/playlists.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/music_assistant/server/helpers/playlists.py b/music_assistant/server/helpers/playlists.py index 62a7a8fa..05442da7 100644 --- a/music_assistant/server/helpers/playlists.py +++ b/music_assistant/server/helpers/playlists.py @@ -86,12 +86,15 @@ def parse_m3u(m3u_data: str) -> list[PlaylistItem]: # Ignore other extensions continue elif len(line) != 0: - if "%20" in line: + filepath = line + if "%20" in filepath: # apparently VLC manages to encode spaces in filenames - line = line.replace("%20", " ") # noqa: PLW2901 + filepath = filepath.replace("%20", " ") + # replace Windows directory separators + filepath = filepath.replace("\\", "/") playlist.append( PlaylistItem( - path=line, length=length, title=title, stream_info=stream_info, key=key + path=filepath, length=length, title=title, stream_info=stream_info, key=key ) ) # reset the song variables so it doesn't use the same EXTINF more than once -- 2.34.1