From c288d56b041ca1c3c934e1db0e7851d88637fe9f Mon Sep 17 00:00:00 2001 From: Lovi <62809003+Lovi-0@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:44:50 +0100 Subject: [PATCH] Thank to @Demential98 for fix problem with "..." on create folder. --- Src/Util/os.py | 12 +++++++++++- config.json | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Src/Util/os.py b/Src/Util/os.py index 9aa9a3a..bbbccb0 100644 --- a/Src/Util/os.py +++ b/Src/Util/os.py @@ -95,13 +95,23 @@ def remove_special_characters(input_string): if input_string is None: return "None" + # Check if the string ends with '.mp4' + # If it does, we temporarily remove the '.mp4' extension for processing + ends_with_mp4 = input_string.endswith('.mp4') + if ends_with_mp4: + input_string = input_string[:-4] # Remove the last 4 characters ('.mp4') + # Compile regular expression pattern to match special characters pattern = re.compile('[' + re.escape(special_chars_to_remove) + ']') # Use compiled pattern to replace special characters with an empty string cleaned_string = pattern.sub('', input_string) - return cleaned_string + # If the original string had the '.mp4' extension, re-add it to the cleaned string + if ends_with_mp4: + cleaned_string += '.mp4' + + return cleaned_string.strip() diff --git a/config.json b/config.json index 38dac84..4abfceb 100644 --- a/config.json +++ b/config.json @@ -7,7 +7,7 @@ "clean_console": true, "root_path": "Video", "map_episode_name": "%(tv_name)_S%(season)E%(episode)_%(episode_name)", - "special_chars_to_remove": "!@#$%^&*()[]{}<>|`~'\";:,?=+\u00e2\u20ac\u00a6", + "special_chars_to_remove": ".-!@#$%^&*()[]{}<>|`~'\";:,?=+\u00e2\u20ac\u00a6", "config_qbit_tor": { "host": "192.168.1.59", "port": "8080",