mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 03:27:34 +00:00
fix: Update version to 0.9.4 in uv.lock; improve CI checks and code clarity in AGENTS.md, filename_extractor.py, and mediainfo_extractor.py
This commit is contained in:
@@ -227,10 +227,9 @@ class FilenameExtractor:
|
||||
# Check for bare resolution numbers inside brackets (e.g., [720,ukr,eng])
|
||||
bare_match = re.search(r'[\[,](\d{3,4})(?=[,\]])', normalized_name, re.IGNORECASE)
|
||||
if bare_match:
|
||||
height = int(bare_match.group(1))
|
||||
frame_class = self._get_frame_class_from_height(height)
|
||||
if frame_class:
|
||||
return frame_class
|
||||
bare_fc = self._get_frame_class_from_height(int(bare_match.group(1)))
|
||||
if bare_fc:
|
||||
return bare_fc
|
||||
|
||||
# If no specific resolution found, check for non-standard quality indicators
|
||||
for indicator in NON_STANDARD_QUALITY_INDICATORS:
|
||||
|
||||
@@ -195,7 +195,7 @@ class MediaInfoExtractor:
|
||||
resolution = self.extract_resolution()
|
||||
if not resolution:
|
||||
return None
|
||||
height, width = resolution
|
||||
width, height = resolution
|
||||
|
||||
logger.debug(
|
||||
f"[{self.file_path.name}] Frame class detection - Resolution: {width}x{height}"
|
||||
@@ -329,7 +329,10 @@ class MediaInfoExtractor:
|
||||
return None
|
||||
langs = []
|
||||
for a in tracks:
|
||||
lang_code = getattr(a, "language", "und") or "und"
|
||||
lang_code = getattr(a, "language", None)
|
||||
# Skip tracks with no language tag or 'und' (undetermined)
|
||||
if not lang_code or lang_code.lower() in ("und", "undefined"):
|
||||
continue
|
||||
try:
|
||||
# Try to get the 3-letter code
|
||||
lang_obj = langcodes.Language.get(lang_code.lower())
|
||||
@@ -340,6 +343,9 @@ class MediaInfoExtractor:
|
||||
logger.debug(f"Invalid language code '{lang_code}': {e}")
|
||||
langs.append(lang_code.lower()[:3])
|
||||
|
||||
if not langs:
|
||||
return None # No meaningful language info — let Filename extractor try
|
||||
|
||||
lang_counts = Counter(langs)
|
||||
audio_langs = [
|
||||
f"{count}{lang}" if count > 1 else lang
|
||||
|
||||
@@ -39,7 +39,7 @@ def test_frame_class_detection(test_case):
|
||||
extractor.video_tracks = [mock_track]
|
||||
extractor._get_tracks.return_value = [mock_track] # satisfies @requires_tracks_type decorator
|
||||
extractor._get_track.return_value = mock_track
|
||||
extractor.extract_resolution.return_value = (height, width)
|
||||
extractor.extract_resolution.return_value = (width, height)
|
||||
extractor.extract_interlaced.return_value = interlaced
|
||||
|
||||
# Test the method
|
||||
|
||||
Reference in New Issue
Block a user