""" Date: 16th/July/2026 Created by: Jap-Slappa NFO Metadata Updater v1.0 By Gemini """ import sys from pathlib import Path import PySimpleGUI as sg # Set the target folder path here (uses pathlib) # e.g., Path("F:/Media/Movies") or Path(".") for the current directory TARGET_DIR = Path(r"F:\Media\Movies") def PSG_get_nfo_folder_path(): My_default_folder_path = r'\\192.168.4.212\web\00.My_Watclists_4_Kodi\Anime-TV-(Blank-nfos)' selected_folder = sg.popup_get_folder('Get Folder Path', default_path=My_default_folder_path) print('selected_folder: \n', selected_folder) return selected_folder #? === End Of Function == def update_nfo_files(directory_path: Path): # Ensure the directory exists if not directory_path.exists() or not directory_path.is_dir(): print(f"Error: The directory '{directory_path}' does not exist.") return changed_files = [] unchanged_files = [] total_files_found = 0 # Using rglob("*.nfo") to scan recursively (checks subfolders too) # Use glob("*.nfo") instead if you only want to scan the top-level folder # nfo_files = list(directory_path.rglob("*.nfo")) # OG Gemini Code nfo_files = list(directory_path.iterdir("*.nfo")) # Me total_files_found = len(nfo_files) for nfo_path in nfo_files: try: # Read the file content safely with UTF-8 encoding content = nfo_path.read_text(encoding='utf-8', errors='ignore') original_content = content modified = False # Check and replace status if "false" in content: content = content.replace("false", "true") modified = True # Check and replace status if "0" in content: content = content.replace("0", "1") modified = True if modified: # Write the updated content back to the file nfo_path.write_text(content, encoding='utf-8') changed_files.append(nfo_path.name) else: unchanged_files.append(nfo_path.name) except Exception as e: print(f"Failed to process {nfo_path.name} due to error: \n >>>{e}") unchanged_files.append(nfo_path.name) # --- Print Results Summary --- print("\n" + "="*50) print(" NFO WATCHED STATUS UPDATE SUMMARY") print("="*50) print(f"\nTotal .nfo files found: {total_files_found}") print(f"Total .nfo files updated: {len(changed_files)}") print(f"Total .nfo files unchanged: {len(unchanged_files)}") if changed_files: print("\nChanged Files:") for name in changed_files: print(f" [✓] {name}") else: print("\nChanged Files: None") if unchanged_files: print("\nUnchanged Files:") for name in unchanged_files: print(f" [-] {name}") else: print("\nUnchanged Files: None") print("\n" + "="*50) if __name__ == "__main__": # You can change the directory path here before running the script update_nfo_files(TARGET_DIR)