Added revisions to the translation app
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
def scan_for_missing_translations(folder_path, target_lang="English"):
|
||||
print(f"--- Diagnostic Scan: Missing Translations ---")
|
||||
print(f"Target Language: {target_lang}")
|
||||
print(f"Scanning: {folder_path}\n")
|
||||
|
||||
missing_count = 0
|
||||
total_srt = 0
|
||||
|
||||
# Files that need attention
|
||||
missing_files = []
|
||||
|
||||
for root, dirs, files in os.walk(folder_path):
|
||||
for file in files:
|
||||
# Look for source SRT files
|
||||
# Logic: Ends in .srt, but NOT .Lang.srt and NOT .Lang.deep_translate.srt
|
||||
if file.endswith(".srt") and \
|
||||
not file.endswith(f".{target_lang}.srt") and \
|
||||
not file.endswith(f".{target_lang}.deep_translate.srt"):
|
||||
|
||||
total_srt += 1
|
||||
source_path = os.path.join(root, file)
|
||||
base_name = os.path.splitext(file)[0]
|
||||
|
||||
# Check for existing translations
|
||||
path_gemini = os.path.join(root, f"{base_name}.{target_lang}.srt")
|
||||
path_deep = os.path.join(root, f"{base_name}.{target_lang}.deep_translate.srt")
|
||||
|
||||
if not os.path.exists(path_gemini) and not os.path.exists(path_deep):
|
||||
missing_count += 1
|
||||
missing_files.append(source_path)
|
||||
|
||||
if missing_files:
|
||||
print(f"Found {missing_count} files waiting for translation:\n")
|
||||
for f in missing_files:
|
||||
print(f" [MISSING] {f}")
|
||||
else:
|
||||
print("✅ All subtitles appear to be translated!")
|
||||
|
||||
print("\n" + "="*40)
|
||||
print(f"Summary:")
|
||||
print(f"Total Source SRTs Found: {total_srt}")
|
||||
print(f"Missing Translations: {missing_count}")
|
||||
print("="*40)
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Diagnostic: Find missing translations")
|
||||
parser.add_argument("folder", help="Path to the folder to scan")
|
||||
parser.add_argument("lang", nargs="?", default="English", help="Target language (default: English)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not os.path.exists(args.folder):
|
||||
print(f"Error: Folder '{args.folder}' does not exist.")
|
||||
sys.exit(1)
|
||||
|
||||
scan_for_missing_translations(args.folder, args.lang)
|
||||
Reference in New Issue
Block a user