feat: Enhance title normalization by replacing dots with spaces and add test case for multi-dot filenames
This commit is contained in:
BIN
dist/renamer-0.6.10-py3-none-any.whl
vendored
Normal file
BIN
dist/renamer-0.6.10-py3-none-any.whl
vendored
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "renamer"
|
||||
version = "0.6.9"
|
||||
version = "0.6.10"
|
||||
description = "Terminal-based media file renamer and metadata viewer"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
@@ -126,6 +126,13 @@ class FilenameExtractor:
|
||||
# Clean up title: remove leading/trailing brackets and dots
|
||||
title = title.strip('[](). ')
|
||||
|
||||
# Replace dots with spaces if they appear to be word separators
|
||||
# Only replace dots that are surrounded by letters/digits (not at edges)
|
||||
title = re.sub(r'(?<=[a-zA-Z0-9À-ÿ])\.(?=[a-zA-Z0-9À-ÿ])', ' ', title)
|
||||
|
||||
# Clean up multiple spaces
|
||||
title = re.sub(r'\s+', ' ', title).strip()
|
||||
|
||||
return title if title else None
|
||||
|
||||
@cached_method()
|
||||
|
||||
@@ -2,6 +2,24 @@
|
||||
"description": "Comprehensive test dataset for filename metadata extraction",
|
||||
"version": "2.0",
|
||||
"test_cases": [
|
||||
{
|
||||
"filename": "Angelo.dans.la.forêt.mystérieuse.2024.1080p.BluRay.DD.5.1.x265.mkv",
|
||||
"expected": {
|
||||
"order": null,
|
||||
"title": "Angelo dans la forêt mystérieuse",
|
||||
"year": "2024",
|
||||
"source": "BluRay",
|
||||
"frame_class": "1080p",
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
"audio_langs": "",
|
||||
"extension": "mkv"
|
||||
},
|
||||
"testname": "edge-multi-dot-001",
|
||||
"category": "edge_cases",
|
||||
"description": "Title with multiple dots instead of spaces"
|
||||
},
|
||||
{
|
||||
"testname": "simple-001",
|
||||
"filename": "Movie Title (2020) BDRip [1080p,ukr,eng].mkv",
|
||||
@@ -334,7 +352,7 @@
|
||||
"title": "A Mighty Heart",
|
||||
"year": "2007",
|
||||
"source": null,
|
||||
"frame_class": "SD",
|
||||
"frame_class": null,
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
@@ -370,7 +388,7 @@
|
||||
"title": "The Name of the Rose",
|
||||
"year": "1986",
|
||||
"source": null,
|
||||
"frame_class": "SD",
|
||||
"frame_class": null,
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
@@ -388,7 +406,7 @@
|
||||
"title": "12 стульев",
|
||||
"year": "1971",
|
||||
"source": null,
|
||||
"frame_class": "SD",
|
||||
"frame_class": null,
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
@@ -586,7 +604,7 @@
|
||||
"title": "Rekopis znaleziony w Saragossie",
|
||||
"year": "1965",
|
||||
"source": "WEB-DL",
|
||||
"frame_class": "SD",
|
||||
"frame_class": null,
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
@@ -622,7 +640,7 @@
|
||||
"title": "One More Kiss",
|
||||
"year": "1999",
|
||||
"source": "DVDRip",
|
||||
"frame_class": "SD",
|
||||
"frame_class": null,
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
@@ -802,7 +820,7 @@
|
||||
"title": "Золотє теля",
|
||||
"year": "1968",
|
||||
"source": null,
|
||||
"frame_class": "SD",
|
||||
"frame_class": null,
|
||||
"hdr": null,
|
||||
"movie_db": null,
|
||||
"special_info": null,
|
||||
|
||||
Reference in New Issue
Block a user