A bash script that synchronizes photos from Google Drive to a local slideshow folder, converts HEIC images to JPG, and manages a photo frame display using feh.
- Google Drive Sync: Uses
rcloneto sync photos from a Google Drive shared folder - HEIC Conversion: Automatically converts HEIC images to JPG using multiple fallback methods
- Slideshow Management: Starts and manages
fehslideshow with configurable delay - Cleanup: Removes orphaned files and HDR gain maps
- Logging: Comprehensive logging of all operations
rclone- For Google Drive synchronizationfeh- For slideshow displayheif-convert- For HEIC to JPG conversion (primary method)
- ImageMagick (
magickorconvert) - Alternative HEIC conversion exiftool- Extract preview images from HEIC filesrsync- Efficient file copyingxdpyinfo- X display detectionpkill/pgrep- Process management
- Linux system with X11 display
- Google Drive access with rclone configured
- Sufficient disk space for photo storage
-
Clone this repository:
git clone <your-repo-url> cd photoFrame
-
Configure rclone for Google Drive access:
rclone config
Follow the setup wizard to configure your Google Drive remote.
-
Update the configuration variables in
sync-photos.sh:RAW_DIR: Directory for raw photos from Google DriveDISPLAY_DIR: Directory for processed photos ready for displayRCLONE_REMOTE: Your configured rclone remote nameRCLONE_TEAM_DRIVE_ID: Your Google Drive team drive IDRCLONE_SOURCE: Source folder path in Google Drive
-
Make the script executable:
chmod +x sync-photos.sh
Edit the configuration section at the top of sync-photos.sh:
RAW_DIR="/home/gfd/Pictures/PhotoFrame/Raw"
DISPLAY_DIR="/home/gfd/Pictures/PhotoFrame/Display"
RCLONE_REMOTE="gdrive"
RCLONE_TEAM_DRIVE_ID="0ANrWAw4_0pIuUk9PVA"
RCLONE_SOURCE="Display on TV"
SLIDESHOW_DELAY="10"./sync-photos.shAdd to crontab for regular synchronization:
# Sync every 30 minutes
*/30 * * * * /path/to/photoFrame/sync-photos.sh
# Or sync every hour
0 * * * * /path/to/photoFrame/sync-photos.sh- Sync: Downloads photos from Google Drive to the raw directory
- Convert: Converts HEIC images to JPG using multiple fallback methods
- Copy: Copies non-HEIC images to the display directory
- Cleanup: Removes orphaned files and HDR gain maps
- Display: Restarts the feh slideshow with new photos
The script tries multiple methods to convert HEIC images:
- heif-convert (primary) - Fast and efficient
- ImageMagick - Fallback using
magickorconvert - exiftool - Extracts preview images as last resort
- Quarantine - Moves problematic files to
.quarantinedirectory
All operations are logged to /home/gfd/Pictures/PhotoFrame/sync.log with timestamps.
- X Display Not Ready: Ensure X11 is running and
DISPLAYis set correctly - HEIC Conversion Fails: Install
heif-convertor ImageMagick - Rclone Errors: Verify Google Drive configuration and permissions
- Permission Denied: Check file permissions and ownership
Run with verbose output:
bash -x sync-photos.shThis project is open source. Feel free to modify and distribute.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
For issues and questions, please open an issue on GitHub.