From a85ecdb52d3eb1986b9f42cd7877993eb6066673 Mon Sep 17 00:00:00 2001 From: sHa Date: Fri, 2 Jan 2026 12:43:55 +0000 Subject: [PATCH] fix: Increase width tolerance for frame class matching to accommodate ultrawide aspect ratios --- renamer/extractors/mediainfo_extractor.py | 3 ++- renamer/test/datasets/mediainfo/frame_class_tests.json | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/renamer/extractors/mediainfo_extractor.py b/renamer/extractors/mediainfo_extractor.py index 2c4ed18..9cdcbd8 100644 --- a/renamer/extractors/mediainfo_extractor.py +++ b/renamer/extractors/mediainfo_extractor.py @@ -90,10 +90,11 @@ class MediaInfoExtractor: effective_height = height # First, try to match width to typical widths + # Use a larger tolerance (10 pixels) to handle cinema/ultrawide aspect ratios width_matches = [] for frame_class, info in FRAME_CLASSES.items(): for tw in info['typical_widths']: - if abs(width - tw) <= 5 and frame_class.endswith(scan_type): + if abs(width - tw) <= 10 and frame_class.endswith(scan_type): diff = abs(height - info['nominal_height']) width_matches.append((frame_class, diff)) diff --git a/renamer/test/datasets/mediainfo/frame_class_tests.json b/renamer/test/datasets/mediainfo/frame_class_tests.json index 531b36c..b376be6 100644 --- a/renamer/test/datasets/mediainfo/frame_class_tests.json +++ b/renamer/test/datasets/mediainfo/frame_class_tests.json @@ -148,5 +148,11 @@ "interlaced": false, "expected_frame_class": "1080p", "testname": "test-mistakenly-high-height" + }, + { + "resolution": [1912,798], + "interlaced": false, + "expected_frame_class": "1080p", + "testname": "test-mistakenly-high-height-2" } ] \ No newline at end of file