h0axd Posted October 31, 2024 Group: Members Topic Count: 1 Topics Per Day: 0.01 Content Count: 1 Reputation: 0 Joined: 10/31/24 Last Seen: November 5, 2024 Share Posted October 31, 2024 Just because I want to bring this art into other genre's, I'll be using AI to give original animations more frames, I am using Pro builder and the original meshes for the levels. So I made this short script to decode and then translate the file names into ASCII and English. It's in python. You'll need the google translate api so first | pip install googletrans==4.0.0-rc1 Then run the following after replacing the folder path import os import re from googletrans import Translator def decode_and_translate(folder_path): # Initialize the translator translator = Translator() # Regex pattern to detect non-ASCII characters (usually indicates Korean) non_ascii_pattern = re.compile(r'[^\x00-\x7F]+') # Loop through each file in the folder for filename in os.listdir(folder_path): # Check if the filename contains non-ASCII (likely Korean) characters if non_ascii_pattern.search(filename): try: # Decode filename from EUC-KR to get the Korean characters decoded_name = filename.encode('latin1').decode('euc-kr', errors='ignore') # Translate the decoded filename from Korean to English translated_name = translator.translate(decoded_name, src='ko', dest='en').text # Preserve the original file extension file_extension = os.path.splitext(filename)[1] translated_file_name = f"{translated_name}{file_extension}" # Construct full paths for renaming original_file_path = os.path.join(folder_path, filename) translated_file_path = os.path.join(folder_path, translated_file_name) # Rename the file os.rename(original_file_path, translated_file_path) print(f'Renamed: "{filename}" to "{translated_file_name}"') except UnicodeDecodeError as e: print(f"Encoding error with {filename}: {e}") except Exception as e: print(f"Error processing {filename}: {e}") else: print(f"Skipped: {filename} (already in English)") # Usage folder_path = r'<insert your folder path here>' # Replace with your folder path decode_and_translate(folder_path) You should get an output something like Ignore the double extensions I cant get it to stop doing that I'll throw another script to trim with regex. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.