Lightroom File Management Utility
A Docker-based utility for rationalizing multiple Lightroom libraries and backup directories. This tool helps identify and manage duplicate photography files, misallocated directories, and unused storage space across multiple Lightroom installations.
- Multiple Lightroom libraries (Personal and Work photography)
- Multiple backup directories created over several years
- Files and directories potentially duplicated across locations
- Some folders incorrectly categorized (e.g., personal photos in work library)
- DNG (Leica cameras)
- Proprietary RAW formats (Sony, Canon)
- JPEG (excluding export directories)
- Export directories (named '3StarQ70' or '_N_StarQxx') are excluded from comparison
- These are Lightroom-generated JPEGs stored in subdirectories
- Quality indicators (N) represent subjective curation ratings
- Container: Docker
- Database: PostgreSQL
- Primary Language: Python
- Development Environment: Cursor IDE with Claude Sonnet 3.7
- PostgreSQL 14+
- Tables for:
- File metadata
- Directory structures
- Category assignments
- Duplicate tracking
- Docker 20.10+
- Basic knowledge of YAML configuration
-
Clone the repository:
git clone https://github.com/yourusername/lr-mig2.git cd lr-mig2 -
Make bootstrap script executable:
chmod +x bootstrap.sh chmod +x test.sh
-
Edit configuration files:
config/container_config.yaml: Configure mount points for your photo directoriesconfig/scan_targets.yaml: Configure which directories to scan
-
Run the utility:
./bootstrap.sh
./bootstrap.sh# Run with verbose output
./bootstrap.sh --verbose
# Scan only a specific group
./bootstrap.sh --group personal
# Use a different scan configuration
./bootstrap.sh --scan-config config/my_custom_scan.yaml# Run tests
./test.sh
# Clean and regenerate test data
./test.sh --cleanThe container_config.yaml file configures Docker settings and mount points:
# Container configuration
database:
host: db
port: 5432
name: lrmig2
user: postgres
password: postgres
application:
log_level: INFO
container:
# Base directories to mount
mount_points:
- host_path: /path/to/photos # Path on host machine
container_path: /data/photos # Path in container
- host_path: /mnt/backup # Path on host machine
container_path: /data/backup # Path in containerThe scan_targets.yaml file defines which directories to scan:
# Target directories for scanning
target_directories:
personal:
- path: /data/photos/personal/2022
description: "Personal photos 2022"
category: "P" # P for Personal
- path: /data/photos/personal/2023
description: "Personal photos 2023"
category: "P"
work:
- path: /data/photos/work
description: "Work photos"
category: "W" # W for Work
# Global scan settings
settings:
recursive: true
excluded_patterns:
- "*StarQ*"
- "export_*"-
Initial Scan
- Scan target directories
- Build database of files and metadata
- Record directory locations and full paths
-
Category Assignment
- User reviews directory list
- Assigns categories via spreadsheet (category_assignment.csv)
- Categories: P (Personal) or W (Work)
-
Library Integration
- User provides primary library locations
- System assigns categories to all subfolders
- User reviews and corrects miscategorizations
-
Duplicate Detection
- Exact Duplicates: Same name, file count, and size
- Partial Duplicates:
- "Folder duplicate plus y%": Backup has additional files
- "Folder duplicate minus y%": Backup has fewer files
- Excludes export directories (NStarQxx)
- Python 3.9+ required
- Follow PEP 8 style guide
- Include type hints
- Document all functions and classes
- Unit tests for all core functions
- Integration tests for database operations
- Test data sets for edge cases
- Automated test suite
- One functional area per commit
- Meaningful commit messages
- Regular commits
- Feature branches for new development
- Maintain DEVELOPMENT_PLAN.md
- Update version numbers on completed tasks
- Document all API endpoints
- Include setup instructions
- All logs are kept in version control in the
logsdirectory - Log files are named with date and git commit information:
tests_YYYY-MM-DD_commit:hash_date:date.log - This allows easy correlation between:
- Test results
- Code state (via commit hash)
- Timeline of changes
- Log format includes:
- Timestamp
- Logger name
- Log level
- Message
- Git commit information
- Log levels should be used appropriately:
- DEBUG: Detailed information for debugging
- INFO: General operational information
- WARNING: Warning messages for potentially harmful situations
- ERROR: Error events that might still allow the application to continue
- CRITICAL: Critical events that may lead to application termination
- Historical debugging capability
- Performance tracking over time
- Easy rollback reference
- Correlation between code changes and test results
- Documentation of system behavior across different states
- File scanning implementation
- Metadata extraction and storage
- Basic database schema
- Initial test suite
- Manual category assignment interface
- Category validation tools
- User review workflow
- Category correction tools
- Duplicate detection algorithms
- Directory comparison tools
- Misallocation detection
- Storage optimization analysis
- File movement functions
- Directory reorganization
- Audit logging
- Recovery procedures
- Safe deletion procedures
- Backup to slow storage
- Recovery verification
- Final cleanup tools
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
[License information to be added]
[Contact information to be added]