import re def clean_movie_filename_advanced(filename): # 1. Handle common group prefixes like 'VegamoviesHD' at the start cleaned = re.sub(r'^[a-zA-Z0-9]+HD\b', '', filename, flags=re.IGNORECASE).strip() # 2. Convert underscores, dots, and hyphens to spaces to reveal words cleaned = re.sub(r'[\._\-]', ' ', cleaned) # 3. Find and isolate the year (typically 4 digits starting with 19 or 20) year_match = re.search(r'(19|20)\d2', cleaned) if year_match: year = year_match.group(0) # Title is usually everything before the year title_raw = cleaned.split(year)[0].strip() # Clean title: CamelCase to Space conversion (e.g., BlackAdam -> Black Adam) title = re.sub(r'(?<=[a-z])(?=[A-Z])', ' ', title_raw) return f"title (year)" return cleaned input_str = "VegamoviesHD BlackAdam2022V3720pHDCAMRipHINDIDUB1XBET-Vegamoviestomkv" print(f"Original: input_str") print(f"Cleaned: clean_movie_filename_advanced(input_str)") Use code with caution. Copied to clipboard
: Detects the release year (2022) to separate the title from the metadata. Formatting : Reconstructs the name as Black Adam (2022) . Implementation (Python)
: The most powerful tool for automatically matching files to TheMovieDB and renaming them perfectly.
Using a script or tool to automate this process ensures your media library remains organized and searchable. : Prefix Removal : Strips group names like "VegamoviesHD".
Добавлен в корзину
Количество:
0
Сумма: 0 ₽
Товары в корзине
Промокоды и бонусы вы сможете применить при оформлении заказа.
import re def clean_movie_filename_advanced(filename): # 1. Handle common group prefixes like 'VegamoviesHD' at the start cleaned = re.sub(r'^[a-zA-Z0-9]+HD\b', '', filename, flags=re.IGNORECASE).strip() # 2. Convert underscores, dots, and hyphens to spaces to reveal words cleaned = re.sub(r'[\._\-]', ' ', cleaned) # 3. Find and isolate the year (typically 4 digits starting with 19 or 20) year_match = re.search(r'(19|20)\d2', cleaned) if year_match: year = year_match.group(0) # Title is usually everything before the year title_raw = cleaned.split(year)[0].strip() # Clean title: CamelCase to Space conversion (e.g., BlackAdam -> Black Adam) title = re.sub(r'(?<=[a-z])(?=[A-Z])', ' ', title_raw) return f"title (year)" return cleaned input_str = "VegamoviesHD BlackAdam2022V3720pHDCAMRipHINDIDUB1XBET-Vegamoviestomkv" print(f"Original: input_str") print(f"Cleaned: clean_movie_filename_advanced(input_str)") Use code with caution. Copied to clipboard
: Detects the release year (2022) to separate the title from the metadata. Formatting : Reconstructs the name as Black Adam (2022) . Implementation (Python) Find and isolate the year (typically 4 digits
Using a script or tool to automate this process ensures your media library remains organized and searchable. : Prefix Removal : Strips group names like "VegamoviesHD".