terrelsa13 / MUMC

Multi-User Media Cleaner aka MUMC (pronounced Mew-Mick) will go through movies, tv episodes, audio tracks, and audiobooks in your Emby/Jellyfin libraries deleting media items you no longer want.
GNU General Public License v3.0
92 stars 6 forks source link

Crash When Deleting File with Cyrillic characters or emojis in the file name. #86

Closed netcaretx closed 10 months ago

netcaretx commented 1 year ago

Goal was to delete downloaded Youtube video after watching them, but many have unusual characters in the file name and always generate a crash while trying to delete them.

Example: :[DELETE] - Movie - 8H Rain Inside Car 🌧️ Harry Potter ASMR Ambience 🌧️ Flying Car with Harry & R on - Back to Hogwarts - Unknown - Played <1 day ago - Play Count: 1 - Created <1 day ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 846917 Traceback (most recent call last): File "C:\Users\Richard\Desktop\MUMC-MUMC\mumc.py", line 8595, in movie_dict,movie_found=get_media_items('movie',config_dict,movie_dict,user_key) File "C:\Users\Richard\Desktop\MUMC-MUMC\mumc.py", line 6037, in get_media_items build_print_media_item_details(item,mediaType,output_state_dict) File "C:\Users\Richard\Desktop\MUMC-MUMC\mumc.py", line 5043, in build_print_media_item_details print_byType(':[DELETE] - ' + item_output_details,print_media_delete_info) File "C:\Users\Richard\Desktop\MUMC-MUMC\mumc.py", line 107, in print_byType appendTo_DEBUG_log(string_to_print,1) File "C:\Users\Richard\Desktop\MUMC-MUMC\mumc.py", line 99, in appendTo_DEBUG_log save_file(str(string_to_save),GLOBAL_DEBUG_FILE_NAME,"a") File "C:\Users\Richard\Desktop\MUMC-MUMC\mumc.py", line 1476, in save_file f.write(dataInput) File "C:\Users\Richard\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 40-41: character maps to

terrelsa13 commented 11 months ago

@netcaretx Looks like you have debug on and it is crashing when it is trying to write Cyrillic and emojis to the debug log. If debug is not needed please turn it off.

Python uses unicode by default. So it should be able to handle Cyrillic and emjoi without any issues. As you can see in your post the "cloudy-rainy" emoji printed.

terrelsa13 commented 10 months ago

This is resolved with v5.2.0 on the beta branch.

When printing to the debug log, if an emjoi is found it is remove and replaced with ***emoji_removed***