mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 19:43:28 +00:00
- 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.
16 lines
440 B
Python
16 lines
440 B
Python
from datetime import datetime
|
|
|
|
|
|
class DateFormatter:
|
|
"""Class for formatting dates"""
|
|
|
|
@staticmethod
|
|
def format_modification_date(mtime: float) -> str:
|
|
"""Format file modification time"""
|
|
return datetime.fromtimestamp(mtime).strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
@staticmethod
|
|
def format_year(year: float | None) -> str:
|
|
"""Format year from float to string"""
|
|
return f"({year})" if year else ""
|