feat: Bump version to 0.2.11, update media info extraction logic and add test file

This commit is contained in:
sHa
2025-12-27 04:11:17 +00:00
parent b2144a1014
commit e87769f44b
5 changed files with 7 additions and 7 deletions

BIN
dist/renamer-0.2.11-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.10" version = "0.2.11"
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

@@ -105,7 +105,7 @@ class MediaInfoExtractor:
"""Extract HDR info from media info""" """Extract HDR info from media info"""
if not self.video_tracks: if not self.video_tracks:
return None return None
profile = getattr(self.video_tracks[0], 'format_profile', '') profile = getattr(self.video_tracks[0], 'format_profile', '') or ''
if 'HDR' in profile.upper(): if 'HDR' in profile.upper():
return 'HDR' return 'HDR'
return None return None
@@ -116,15 +116,15 @@ class MediaInfoExtractor:
return None return None
langs = [] langs = []
for a in self.audio_tracks: for a in self.audio_tracks:
lang_code = getattr(a, 'language', 'und').lower() lang_code = getattr(a, 'language', 'und') or 'und'
try: try:
# Try to get the 3-letter code # Try to get the 3-letter code
lang_obj = langcodes.Language.get(lang_code) lang_obj = langcodes.Language.get(lang_code.lower())
alpha3 = lang_obj.to_alpha3() alpha3 = lang_obj.to_alpha3()
langs.append(alpha3) langs.append(alpha3)
except: except:
# If conversion fails, use the original code # If conversion fails, use the original code
langs.append(lang_code[:3]) langs.append(lang_code.lower()[:3])
lang_counts = Counter(langs) lang_counts = Counter(langs)
audio_langs = [f"{count}{lang}" if count > 1 else lang for lang, count in lang_counts.items()] audio_langs = [f"{count}{lang}" if count > 1 else lang for lang, count in lang_counts.items()]
@@ -140,7 +140,7 @@ class MediaInfoExtractor:
'height': getattr(v, 'height', None), 'height': getattr(v, 'height', None),
'bitrate': getattr(v, 'bit_rate', None), 'bitrate': getattr(v, 'bit_rate', None),
'fps': getattr(v, 'frame_rate', None), 'fps': getattr(v, 'frame_rate', None),
'profile': getattr(v, 'format_profile', None), 'profile': getattr(v, 'format_profile', None) or '',
} }
tracks.append(track_data) tracks.append(track_data)
return tracks return tracks

2
uv.lock generated
View File

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