The email functionality has been refactored to eliminate code duplication between the command-line and GUI versions of the media manager.
email_utils.py- Centralized email functionality for both CLI and GUI applications
generate_missing_media_list.py- Now uses shared email modulemedia_manager_gui.py- Now uses shared email moduleemail_debug_test.py- Updated to use new EmailConfig class
- Single source of truth for email functionality
- Fixes only need to be applied in one place
- Consistent behavior across CLI and GUI
- Unified EmailConfig class
- Support for both hardcoded (CLI) and config file (GUI) approaches
- Validation of email configuration
- Cleaner, more modular code
- Easier to add new email features
- Better error handling and logging
The CLI script automatically uses hardcoded email settings that can be edited in email_utils.py:
# Users update these values in email_utils.py
def create_email_config_hardcoded():
return EmailConfig(
sender_name="YOUR_NAME_HERE",
sender_email="YOUR_EMAIL_HERE",
receiver_email="RECEIVER_EMAIL_HERE",
password="PASSWORD_HERE",
smtp_server="smtp.server.com",
smtp_port=587
)The GUI continues to use media_manager_config.json for configuration through the interface.
The debug script now uses the shared module and EmailConfig class for consistency.
- GUI configuration files remain unchanged
- Command-line usage remains the same
- All existing functionality preserved
- Could standardize both CLI and GUI to use config files
- Could add support for additional email providers
- Could add email templating capabilities