Sep-14-2021, 06:32 PM
change /path/to/playlist.m3u and /path/to/new_playlist.m3u to your needs.
in_text = open("/path/to/playlist.m3u", "r").read() out_text = "" for line in in_text.splitlines(): if line.startswith("#EXTINF"): out_text += line name = line.split(",", 1)[1] out_text += f'\n{name}.mp3\n' else: out_text += f"{line}\n" print(out_text) with open("/path/to/new_playlist.m3u", "w") as f: f.write(out_text)