diff --git a/src/snowcrypt/main.py b/src/snowcrypt/main.py index 415b188..fca1e84 100755 --- a/src/snowcrypt/main.py +++ b/src/snowcrypt/main.py @@ -3,6 +3,8 @@ import queue import threading import logging +import sys +import re from os import path from datetime import datetime @@ -60,6 +62,11 @@ def _get_args_for(file) -> list: title = tags.title.replace(' (Unabridged)', '') outfile = title + '.m4a' + # Match Microsoft Windows reserved characters and control characters, replace + # them with underline character ('_'). + if sys.platform == 'win32': + outfile = re.sub(r'[<>:"/\\|?*\x00-\x1f]', '_', outfile) + return [infile, outfile, key, iv]