From 8ea94b40f2f2d3e072243d90593dfab372eb3305 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Mon, 1 Sep 2025 16:41:03 +0200 Subject: [PATCH] fucking hell --- radioPlaylist.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/radioPlaylist.py b/radioPlaylist.py index 9234a27..a954e91 100644 --- a/radioPlaylist.py +++ b/radioPlaylist.py @@ -283,8 +283,13 @@ class PlaylistManager: while full_filepath in lines: lines.remove(full_filepath) - with open(playlist_file, 'w') as f: - f.write('\n'.join(lines) + ('\n' if lines else '')) + with open(playlist_file, 'w', encoding='utf-8', errors='strict') as f: + for line in lines: + try: + f.write(line + '\n') + except UnicodeEncodeError as e: + print("⚠️ Encoding error in line:", repr(line)) + raise def is_file_item_in_playlist(self, file_item: FileItem, day: str, period: str, playlists: Dict) -> bool: """Check if ALL files from a FileItem are in the specified playlist."""