feat: Bump version to 0.2.7, enhance frame class extraction logic for better matching

This commit is contained in:
sHa
2025-12-27 03:24:40 +00:00
parent 140b88c0a8
commit e9153d2225
4 changed files with 20 additions and 3 deletions

BIN
dist/renamer-0.2.7-py3-none-any.whl vendored Normal file

Binary file not shown.

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "renamer" name = "renamer"
version = "0.2.6" version = "0.2.7"
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"

View File

@@ -22,10 +22,27 @@ class MediaInfoExtractor:
self.sub_tracks = [] self.sub_tracks = []
def _get_frame_class_from_height(self, height: int) -> str | None: def _get_frame_class_from_height(self, height: int) -> str | None:
"""Get frame class from video height using FRAME_CLASSES constant""" """Get frame class from video height, finding closest match if exact not found"""
if not height:
return None
# First try exact match
for frame_class, info in FRAME_CLASSES.items(): for frame_class, info in FRAME_CLASSES.items():
if height == info['nominal_height']: if height == info['nominal_height']:
return frame_class return frame_class
# If no exact match, find closest
closest = None
min_diff = float('inf')
for frame_class, info in FRAME_CLASSES.items():
diff = abs(height - info['nominal_height'])
if diff < min_diff:
min_diff = diff
closest = frame_class
# Only return if difference is reasonable (within 50 pixels)
if min_diff <= 50:
return closest
return None return None
def extract_duration(self) -> float | None: def extract_duration(self) -> float | None:

2
uv.lock generated
View File

@@ -164,7 +164,7 @@ wheels = [
[[package]] [[package]]
name = "renamer" name = "renamer"
version = "0.2.6" version = "0.2.7"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "langcodes" }, { name = "langcodes" },