From: Melvyn Harbour Date: Mon, 8 Jul 2024 12:58:48 +0000 (+0100) Subject: Replace windows separators in m3u (#1471) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=4e07a5d5cde6ee70234c03c034fe30013713bad2;p=music-assistant-server.git Replace windows separators in m3u (#1471) --- 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