mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
Add rename service and utility modules for file renaming operations
- Implemented RenameService for handling file renaming with features like name validation, proposed name generation, conflict detection, and atomic rename operations. - Created utility modules for language code extraction, regex pattern matching, and frame class matching to centralize common functionalities. - Added comprehensive logging for error handling and debugging across all new modules.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import mutagen
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from ..constants import MEDIA_TYPES
|
||||
from ..decorators import cached_method
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MetadataExtractor:
|
||||
"""Class to extract information from file metadata"""
|
||||
@@ -12,7 +15,8 @@ class MetadataExtractor:
|
||||
self._cache = {} # Internal cache for method results
|
||||
try:
|
||||
self.info = mutagen.File(file_path) # type: ignore
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.debug(f"Failed to read metadata from {file_path}: {e}")
|
||||
self.info = None
|
||||
|
||||
@cached_method()
|
||||
@@ -52,5 +56,6 @@ class MetadataExtractor:
|
||||
if info['mime'] == mime:
|
||||
return info['meta_type']
|
||||
return 'Unknown'
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.debug(f"Failed to detect MIME type for {self.file_path}: {e}")
|
||||
return 'Unknown'
|
||||
Reference in New Issue
Block a user