refactor: enhance scan type detection logic and add test case for interlaced 1080i frame class
This commit is contained in:
BIN
dist/renamer-0.8.8-py3-none-any.whl
vendored
Normal file
BIN
dist/renamer-0.8.8-py3-none-any.whl
vendored
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "renamer"
|
name = "renamer"
|
||||||
version = "0.8.7"
|
version = "0.8.8"
|
||||||
description = "Terminal-based media file renamer and metadata viewer"
|
description = "Terminal-based media file renamer and metadata viewer"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
@@ -78,9 +78,21 @@ class MediaInfoExtractor:
|
|||||||
if not height or not width:
|
if not height or not width:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Check if interlaced
|
# Check if interlaced - try multiple attributes
|
||||||
|
# PyMediaInfo may use different attribute names depending on version
|
||||||
|
scan_type_attr = getattr(self.video_tracks[0], 'scan_type', None)
|
||||||
interlaced = getattr(self.video_tracks[0], 'interlaced', None)
|
interlaced = getattr(self.video_tracks[0], 'interlaced', None)
|
||||||
scan_type = 'i' if interlaced == 'Yes' else 'p'
|
|
||||||
|
# Determine scan type from available attributes
|
||||||
|
# Check scan_type first (e.g., "Interlaced", "Progressive", "MBAFF")
|
||||||
|
if scan_type_attr and isinstance(scan_type_attr, str):
|
||||||
|
scan_type = 'i' if 'interlaced' in scan_type_attr.lower() else 'p'
|
||||||
|
# Then check interlaced flag (e.g., "Yes", "No")
|
||||||
|
elif interlaced and isinstance(interlaced, str):
|
||||||
|
scan_type = 'i' if interlaced.lower() in ['yes', 'true', '1'] else 'p'
|
||||||
|
else:
|
||||||
|
# Default to progressive if no information available
|
||||||
|
scan_type = 'p'
|
||||||
|
|
||||||
# Calculate effective height for frame class determination
|
# Calculate effective height for frame class determination
|
||||||
aspect_ratio = 16 / 9
|
aspect_ratio = 16 / 9
|
||||||
|
|||||||
@@ -2,6 +2,24 @@
|
|||||||
"description": "Comprehensive test dataset for filename metadata extraction",
|
"description": "Comprehensive test dataset for filename metadata extraction",
|
||||||
"version": "2.0",
|
"version": "2.0",
|
||||||
"test_cases": [
|
"test_cases": [
|
||||||
|
{
|
||||||
|
"filename": "Le Jaguar.(1996).[1080i,3ukr,fra].mkv",
|
||||||
|
"expected": {
|
||||||
|
"order": null,
|
||||||
|
"title": "Le Jaguar",
|
||||||
|
"year": "1996",
|
||||||
|
"source": null,
|
||||||
|
"frame_class": "1080i",
|
||||||
|
"hdr": null,
|
||||||
|
"movie_db": null,
|
||||||
|
"special_info": null,
|
||||||
|
"audio_langs": "3ukr,fra",
|
||||||
|
"extension": "mkv"
|
||||||
|
},
|
||||||
|
"testname": "edge-frameclass-001",
|
||||||
|
"category": "edge_cases",
|
||||||
|
"description": "Interlaced 1080i frame class"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"filename": "Dumbo.1941.BluRay.1080p.DD5.1.AVC.REMUX.mkv",
|
"filename": "Dumbo.1941.BluRay.1080p.DD5.1.AVC.REMUX.mkv",
|
||||||
"expected": {
|
"expected": {
|
||||||
|
|||||||
Reference in New Issue
Block a user