diff --git a/SaveMyPlaylist.py b/SaveMyPlaylist.py index 696337210052cfda717e033aca582d90d9775e2e..14ec3c005b23d5ef2849db6e19ab8ebe678c9ccd 100644 --- a/SaveMyPlaylist.py +++ b/SaveMyPlaylist.py @@ -60,7 +60,7 @@ class SaveMyPlaylist: TITLE = 1 VIDEO_ID = 2 - ILLEGAL_CHARS = ['NUL', '\',''//', ':', '*', '"', '<', '>', '|'] + ILLEGAL_CHARS = ['NUL', '\\', '/', ':', '*', '"', '<', '>', '|'] def __init__(self, apiKey, playlistId): with open('version.json', 'r', encoding='utf-8') as f: @@ -174,6 +174,11 @@ class SaveMyPlaylist: for char in self.ILLEGAL_CHARS: fileName = fileName.replace(char, '') + try: + fileName = fileName.encode('ascii', 'ignore').decode('ascii') + except Exception as e: + logger.error(f'Error while converting filenem "{fileName}" to ascii', exc_info=e) + return fileName