Gargi.2022.720p.-movielinkbd.com-.sonyliv.web-d... [CONFIRMED ⇒]

print("--- Extracted Metadata ---") print(f"Original: raw_input") print(f"Title: parsed_data.title") print(f"Year: parsed_data.year") print(f"Quality: parsed_data.resolution") print(f"Source: parsed_data.source") print("-" * 25) print(f"Renamed: clean_name") except ValueError as e: print(f"Error: e") When you run this code with your provided string, the output is:

# 3. Extract Source (e.g., WEB-DL, BluRay, WEBRip) # Handling the specific 'WEB-D' cutoff in your example source_match = re.search(r'(WEB-DL|WEBRip|BluRay|HDTV|DVDRip)', filename, re.IGNORECASE) source = source_match.group(0).upper() if source_match else "Unknown" Gargi.2022.720p.-MovieLinkBD.com-.SONYLIV.WEB-D...

if not title_year_match: raise ValueError("Could not parse title and year.") Extract Title and Year # Looks for pattern: Words

This feature takes a messy, release-group formatted filename and converts it into a clean, metadata-rich format suitable for media libraries (like Plex, Jellyfin, or Kodi). filename) # 2. Extract Resolution (e.g.

# 1. Extract Title and Year # Looks for pattern: Words.YYYY title_year_match = re.search(r'^(.*?)\.(\d4)\.', filename)

# 2. Extract Resolution (e.g., 720p, 1080p, 4K) res_match = re.search(r'\b(2160p|1080p|720p|480p)\b', filename) resolution = res_match.group(0) if res_match else "Unknown"