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:
@@ -647,7 +647,12 @@ except (LookupError, ValueError, AttributeError) as e:
|
|||||||
|
|
||||||
1. **Read Before Modify**: Always read files before suggesting modifications
|
1. **Read Before Modify**: Always read files before suggesting modifications
|
||||||
2. **Follow Existing Patterns**: Understand established architecture before changes
|
2. **Follow Existing Patterns**: Understand established architecture before changes
|
||||||
3. **Test Everything**: Run `uv run pytest` after all changes
|
3. **Run CI Checks After Every Code Change**: After any code modification, run the same checks as GitHub CI:
|
||||||
|
```bash
|
||||||
|
uv run pytest # all tests must pass
|
||||||
|
uv run mypy src/ --ignore-missing-imports # no type errors
|
||||||
|
```
|
||||||
|
Do NOT consider work complete until both commands succeed.
|
||||||
4. **Simplicity First**: Avoid over-engineering solutions
|
4. **Simplicity First**: Avoid over-engineering solutions
|
||||||
5. **Document Changes**: Update relevant documentation
|
5. **Document Changes**: Update relevant documentation
|
||||||
|
|
||||||
|
|||||||
@@ -227,10 +227,9 @@ class FilenameExtractor:
|
|||||||
# Check for bare resolution numbers inside brackets (e.g., [720,ukr,eng])
|
# Check for bare resolution numbers inside brackets (e.g., [720,ukr,eng])
|
||||||
bare_match = re.search(r'[\[,](\d{3,4})(?=[,\]])', normalized_name, re.IGNORECASE)
|
bare_match = re.search(r'[\[,](\d{3,4})(?=[,\]])', normalized_name, re.IGNORECASE)
|
||||||
if bare_match:
|
if bare_match:
|
||||||
height = int(bare_match.group(1))
|
bare_fc = self._get_frame_class_from_height(int(bare_match.group(1)))
|
||||||
frame_class = self._get_frame_class_from_height(height)
|
if bare_fc:
|
||||||
if frame_class:
|
return bare_fc
|
||||||
return frame_class
|
|
||||||
|
|
||||||
# If no specific resolution found, check for non-standard quality indicators
|
# If no specific resolution found, check for non-standard quality indicators
|
||||||
for indicator in NON_STANDARD_QUALITY_INDICATORS:
|
for indicator in NON_STANDARD_QUALITY_INDICATORS:
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ class MediaInfoExtractor:
|
|||||||
resolution = self.extract_resolution()
|
resolution = self.extract_resolution()
|
||||||
if not resolution:
|
if not resolution:
|
||||||
return None
|
return None
|
||||||
height, width = resolution
|
width, height = resolution
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"[{self.file_path.name}] Frame class detection - Resolution: {width}x{height}"
|
f"[{self.file_path.name}] Frame class detection - Resolution: {width}x{height}"
|
||||||
@@ -329,7 +329,10 @@ class MediaInfoExtractor:
|
|||||||
return None
|
return None
|
||||||
langs = []
|
langs = []
|
||||||
for a in tracks:
|
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:
|
||||||
# Try to get the 3-letter code
|
# Try to get the 3-letter code
|
||||||
lang_obj = langcodes.Language.get(lang_code.lower())
|
lang_obj = langcodes.Language.get(lang_code.lower())
|
||||||
@@ -340,6 +343,9 @@ class MediaInfoExtractor:
|
|||||||
logger.debug(f"Invalid language code '{lang_code}': {e}")
|
logger.debug(f"Invalid language code '{lang_code}': {e}")
|
||||||
langs.append(lang_code.lower()[:3])
|
langs.append(lang_code.lower()[:3])
|
||||||
|
|
||||||
|
if not langs:
|
||||||
|
return None # No meaningful language info — let Filename extractor try
|
||||||
|
|
||||||
lang_counts = Counter(langs)
|
lang_counts = Counter(langs)
|
||||||
audio_langs = [
|
audio_langs = [
|
||||||
f"{count}{lang}" if count > 1 else lang
|
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.video_tracks = [mock_track]
|
||||||
extractor._get_tracks.return_value = [mock_track] # satisfies @requires_tracks_type decorator
|
extractor._get_tracks.return_value = [mock_track] # satisfies @requires_tracks_type decorator
|
||||||
extractor._get_track.return_value = mock_track
|
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
|
extractor.extract_interlaced.return_value = interlaced
|
||||||
|
|
||||||
# Test the method
|
# Test the method
|
||||||
|
|||||||
Reference in New Issue
Block a user