Python script for managing album sharing permissions via Immich API. Supports listing current album permissions and bulk updates through CSV files.
- Python 3.6+
requests
library
pip install requests
The script has two main commands:
Exports all albums and their sharing permissions to CSV:
python album_processor.py list-all --url https://api.example.com --api-key YOUR_API_KEY [--output albums.csv]
If no output file is specified, creates albums_YYYYMMDD_HHMMSS.csv
Updates album sharing permissions from CSV:
python album_processor.py share-albums --url https://api.example.com --api-key YOUR_API_KEY --input albums.csv
Required columns:
- AlbumName
- AlbumId
- Role
- User columns (User 1, User 2, etc.)
Example:
AlbumName;AlbumId;Role;User 1;User 2
Vacation 2023;abc123;viewer;user1@example.com;user2@example.com
Holiday Photos;def456;editor;user3@example.com;
- Users will be added to albums with specified roles
- Existing users' roles will be updated if different
- Users not in CSV will be removed from album
- Empty cells are ignored
The script handles:
- Network connectivity issues
- Server timeouts
- Invalid CSV formats
- Missing users
- Invalid URLs (auto-upgrades to HTTPS)
Operation results include:
- Number of processed albums
- Successful/failed updates
- Removed users
- List of users not found
- 0: Success
- 1: Error (file not found, network error, etc.)