Files
moma/renamer/formatters/extension_extractor.py
T
sha d2ec235458 Refactor extractors and formatters for improved structure and functionality
- Converted static methods to instance methods in FileInfoExtractor and FilenameExtractor for better encapsulation.
- Enhanced MediaInfoExtractor to initialize with file path and extract media information upon instantiation.
- Updated MetadataExtractor to handle metadata extraction with improved error handling and added methods for meta type detection.
- Introduced ColorFormatter for consistent text formatting across the application.
- Refactored MediaFormatter to utilize the new extractor structure and improve output formatting.
- Removed redundant utility functions and replaced them with direct calls in extractors.
- Added ProposedNameFormatter for better handling of proposed filename formatting.
- Updated extension handling to use MEDIA_TYPES for descriptions instead of VIDEO_EXT_DESCRIPTIONS.
2025-12-25 23:35:59 +00:00

16 lines
535 B
Python

from pathlib import Path
from ..constants import MEDIA_TYPES
class ExtensionExtractor:
"""Class for extracting extension information"""
@staticmethod
def get_extension_name(file_path: Path) -> str:
"""Get extension name without dot"""
return file_path.suffix.lower().lstrip('.')
@staticmethod
def get_extension_description(ext_name: str) -> str:
"""Get description for extension"""
return MEDIA_TYPES.get(ext_name, {}).get('description', f'Unknown extension .{ext_name}')