This Python script processes a library of images and their metadata, consolidating them into a single organized structure.
Guide of how to turn an Eagle library into a web hostable format: Publishing Eagle App Library on the Web
- Consolidates multiple metadata.json files into a single JSON file
- Copies and normalizes media files to a centralized location
- Preserves original library structure (files are copied, not moved)
- Normalizes filenames (removes spaces and special characters)
- Maintains relationships between metadata and media files
- Option to process only image files, excluding other media types
- Adds file type information to metadata
- Python 3.x
- No additional dependencies required (uses only standard library)
.
├── library/ # Source directory (git ignored)
│ └── images/
│ └── [various subfolders]/
│ ├── metadata.json
│ └── [image/video files]
├── dist/ # Output directory (git ignored)
│ ├── images/ # Contains copies of processed media files
│ └── metadata.json # Consolidated metadata file
├── transform.py
└── README.md
- Ensure your library structure is set up as shown above
- Run the script:
python3 transform.py- When prompted, choose whether to process only image files:
- Enter 'y' to process only images (skips videos, documents, and other media)
- Enter 'n' or press Enter to process all supported media files
The script will:
- Create a consolidated
metadata.jsonfile in thedistdirectory - Copy and rename media files (except thumbnails) to the
dist/imagesdirectory - Update file references in the metadata to match the new file locations
- Add file type information to each metadata entry
- Leave all original files in the library directory unchanged