new_name = f"{info['show']} - S{info['season']:02d}E{info['episode']:02d} - {info['quality']} {info['source'].upper()}{info['extension']}" new_path = (output_dir or old_path.parent) / new_name
show = match.group(1).replace('.', ' ').replace('_', ' ').strip().title() season = int(match.group(2)) episode = int(match.group(3)) quality = match.group(4) or "unknown" source = match.group(5) or "unknown" the pitt s01e11 720p web-dl
# Pattern: show name + sXXeYY + optional quality + optional source pattern = r'^(.*?)\s+s(\d+)e(\d+)\s+(\d+p)?\s*-?\s*(\w+)?$' match = re.search(pattern, name, re.IGNORECASE) str(new_path)) print(f"✓ Renamed to: {new_name}") :
# Dry run rename clean_rename(Path(test_file), dry_run=True) the pitt s01e11 720p web-dl
if dry_run: print(f"[DRY RUN] Would rename:\n {old_path.name}\n→ {new_name}\n") else: shutil.move(str(old_path), str(new_path)) print(f"✓ Renamed to: {new_name}")
: