# Synology Thumbnail Generator A Python script that generates thumbnails for Synology Photo Station, optimized for video formats and files that the NAS doesn't handle well. ## 🚀 **Major Features** ### **⚡ Ultra-Fast Icaros Cache Integration** - **Instant thumbnails** from Icaros cache (milliseconds vs seconds) - **Alphabetical algorithm** discovered and implemented - **1920x1080 source quality** from cache - **Automatic fallback** to Windows providers and FFmpeg ### **🎯 Supported Formats** - **Videos**: mp4, webm, avi, mkv, mov, wmv, flv, m4v, ts - **Images**: psd (Photoshop), blend (Blender) - **Optimized for formats** Synology doesn't handle well ### **🔄 Multi-Tier Processing** 1. **Icaros Cache** (fastest - milliseconds) 2. **Windows Thumbnail Providers** (fast - seconds) 3. **FFmpeg/Direct Processing** (slower - reliable fallback) ## 🎉 **Performance Breakthrough** **Before**: 5-10 seconds per video thumbnail (FFmpeg only) **After**: ~50 milliseconds per video thumbnail (Icaros cache) **Speedup**: **100-200x faster** for cached videos! ## 📋 **Requirements** - Python 3.6+ - PIL/Pillow: `pip install Pillow` - FFmpeg (for unsupported formats): https://ffmpeg.org/download.html - **Icaros** (optional, for ultra-fast thumbnails): http://carlosdelgado.com/ ### **Optional Dependencies** - `psd-tools`: For direct PSD processing (`pip install psd-tools`) - `olefile`: For advanced cache integration (`pip install olefile`) ## 💻 **Usage** ```bash python psthumbgen.py --directory "R:\Your\Video\Directory" ``` The script will: 1. **Try Icaros cache first** (if available) 2. **Fall back to Windows providers** 3. **Use FFmpeg as final fallback** 4. **Generate all Synology thumbnail sizes** ## 🔧 **Icaros Integration** ### **Automatic Detection** The script automatically detects and uses Icaros cache from: - `C:\Program Files\Icaros\IcarosCache\` - `C:\Program Files (x86)\Icaros\IcarosCache\` - `%LocalAppData%\Icaros\IcarosCache\` - `%AppData%\Icaros\IcarosCache\` ### **Algorithm Discovery** After extensive analysis, we discovered Icaros uses **alphabetical sorting** for cache mapping: 1. Collect all video files from monitored directories 2. Sort alphabetically (case-insensitive) 3. Map position in sorted list to cache index 4. Extract thumbnail directly from binary cache ## 📁 **Output Structure** For each video file, creates: ``` video_directory/ ├── eaDir_tmp/ │ └── video_file.mp4/ │ ├── SYNOVIDEO_VIDEO_SCREENSHOT.jpg (1280px) │ ├── SYNOPHOTO_THUMB_XL.jpg (1280px) │ ├── SYNOPHOTO_THUMB_B.jpg (640px) │ ├── SYNOPHOTO_THUMB_M.jpg (320px) │ ├── SYNOPHOTO_THUMB_PREVIEW.jpg (160px) │ └── SYNOPHOTO_THUMB_S.jpg (120px) ``` ## 🎯 **Use Cases** - **Video Libraries**: Fast thumbnails for large video collections - **Creative Files**: PSD and Blender file previews - **Network Shares**: Works with SMB/network drives - **Synology NAS**: Perfect for Photo Station integration ## 🛠️ **Technical Details** ### **Icaros Cache Format** - **Binary format**: `.icdb` files containing JPEG thumbnails - **Index structure**: `ICDB` signature with embedded JPEGs - **Multiple sizes**: Typically 96px, 1280px, 2560px variants - **Alphabetical mapping**: Direct position-based extraction ### **Windows Integration** - Uses Windows thumbnail providers via shell32 - Supports formats with installed codec packs - Faster than FFmpeg for supported formats - Automatic format detection and fallback ## 🔍 **Troubleshooting** ### **No Icaros Cache Found** - Install Icaros: http://carlosdelgado.com/ - Configure monitored directories in IcarosConfig - Rebuild cache for current files ### **FFmpeg Not Found** - Download from: https://ffmpeg.org/download.html - Add to system PATH - Restart command prompt/PowerShell ### **Slow Performance** - Install Icaros for 100-200x speedup - Enable hardware acceleration in graphics drivers - Use SSD storage for cache ## 📊 **Algorithm Research** This project involved extensive reverse engineering of Icaros cache format: - ✅ **Alphabetical sorting** algorithm discovered - ❌ Hash-based approaches (MD5, CRC32, Windows hash) all failed - 🔬 **106 cache entries** analyzed and mapped - 🎯 **Verification** through manual thumbnail content checking ## 🤝 **Contributing** Contributions welcome! Areas for improvement: - Additional video format support - Performance optimizations - Cache format documentation - Cross-platform compatibility ## 📄 **License** This project is provided as-is for educational and personal use. --- **🎉 Achievement Unlocked: Ultra-Fast Thumbnail Generation!**