Photo / video organizer and deduplicator implemented in Python 3, for ARMv7 devices
10K+
Docker image hosting a photo / video organizer and deduplicator implemented in Python 3, for ARM / x86 / x64 devices.
Main features :
Detailed features for organizer :
/storage
└── 2021 # [Year]
└── 2021-07 # [Year]-[Month]
└── 20210716_175913-001.jpg # [Year][Month][Day]_[Hour][Min][Sec][-XXX].[ext]
# [-XXX] suffix for files with same date/time
Detailed features for deduplicator :
Other features :
docker logs pyphotorg (or in Portainer web UI)version: "3.3"
services:
# ==========================================================================
# pyphotorg
pyphotorg:
image: ahuh/pyphotorg:latest
container_name: pyphotorg
environment:
# Operation switches
- ENABLE_ORGANIZE=true
- ENABLE_DEDUPLICATE=true
# Dry-run mode (no modification applied) or real mode
- DRY_RUN_MODE=false
# Job scheduler (cron format)
- "SCHEDULE_CRON=15 2 * * sun"
# Deduplicator - Dirs and priority orders for duplicate removal (remove duplicates from highest to lowest number)
- "DEDUP_STORAGE_PATH=/storage/Photos"
- "DEDUP_BACKUP_PATH=/storage/Backup/pyphotorg"
- "DEDUP_DIR_ORDER_01=/storage/Photos/Family"
- "DEDUP_DIR_ORDER_02=/storage/Photos/Friends"
- "DEDUP_DIR_ORDER_03=/storage/Photos/Mobile-A"
- "DEDUP_DIR_ORDER_04=/storage/Photos/Mobile-B"
- "DEDUP_DIR_PATH_FILTER=/.@__thumb"
# Organizer - Path couples: sync dirs (source) and storage dirs (target)
- "ORG_INCOMING_PATH_01=/storage/sync/camera-a"
- "ORG_STORAGE_PATH_01=/storage/Photos/Mobile-A"
- "ORG_INCOMING_PATH_02=/storage/sync/camera-b"
- "ORG_STORAGE_PATH_02=/storage/Photos/Mobile-B"
# Organizer parameters
- ORG_TIMESTAMP_TAGS=FileModifyDate,CreationDate,CreateDate,DateTimeOriginal
- ORG_STORAGE_PATH_PATTERN=%Y/%Y-%m/%Y%m%d_%H%M%S%%-3c.%%e
# User from docker host to impersonate in container
- PUID=500
- PGID=1000
volumes:
- /etc/localtime:/etc/localtime:ro
# Sync dir
- /share/homes/XXX/.Qsync:/storage/sync
# Storage dir
- /share/Perso/Photos:/storage/Photos
# Backup dir
- /share/Perso/Backup/pyphotorg:/storage/Backup/pyphotorg
restart: always
Before running container, you have to retrieve UID and GID for the user used to mount your tv shows directory:
$ id -u <user>
$ id -g <user>
The container will run impersonated as this user, in order to have read/write access to volume directories.
You also need to create volume directories before launching the container with the same user rights.
| Env var name | Default value | Description |
|---|---|---|
| ENABLE_ORGANIZE | true | If enable, organize operation is launch at the beginning of each job execution |
| ENABLE_DEDUPLICATE | true | If enable, deduplicate operation is launch at the end of each job execution |
| DRY_RUN_MODE | false | In dry-run mode, photo / video files are not modified or move : only reports and logs are generated |
| SCHEDULE_CRON | 0 2 * * sun | Schedule for job execution in format min hour day_of_month month day_of_week. See http://en.wikipedia.org/wiki/Cron for details |
| DEDUP_STORAGE_PATH | Storage directory containing photo / videos files to process, during deduplication operation | |
| DEDUP_BACKUP_PATH | Backup directory to use, during deduplication operation. Each duplicate file removed is backed-up in this directory (with the same directory structure as the original). An Excel report is alse generated here at each execution (if duplicate files detected) | |
| DEDUP_DIR_ORDER_XX | OPTIONAL - Multiple variables supported (XX=01, 02, etc). Directory priority orders for duplicate removal (remove duplicates from highest to lowest number) | |
| DEDUP_DIR_PATH_FILTER | OPTIONAL - Directories containing this string are filtered to prevent deduplication. E.g. "/.@__thumb" for QNAP NAS thumbnails generated automatically | |
| ORG_INCOMING_PATH_XX | Multiple variables supported (XX=01, 02, etc). List of incoming directory (source) for move / organize operation. Each value is coupled with the corresponding storage directory value (same XX index). If no variable used: the storage dir is used as source and target ('in-place' organize) | |
| ORG_STORAGE_PATH_XX | Multiple variables supported (XX=01, 02, etc). List of storage directory (target) for move / organize operation. Each value is coupled with the corresponding incoming directory value (same XX index) | |
| ORG_TIMESTAMP_TAGS | FileModifyDate,CreationDate,CreateDate,DateTimeOriginal | List of metadata to use in reverse order of priority for path / filename insertion, during move / organize operation. See documentation here: https://exiftool.org/filename.html#ex12 |
| ORG_STORAGE_PATH_PATTERN | %Y/%Y-%m/%Y%m%d_%H%M%S%%-3c.%%e | Relative path to target dir (base path = ORG_STORAGE_PATH_XX) and target filenames, during organize operation. See documentation here: https://exiftool.org/filename.html#codes |
| PUID | User UID to use for job impersonation | |
| PGID | User GID to use for job impersonation |
In addition to the scheduled jobs, each operation may be launched manually. These commands are available in docker container using docker exec -ti pyphotorg bash (or in Portainer web UI)
$ ./scripts/execPy.sh /work/manual_organize.py -h
$ ./scripts/execPy.sh /work/manual_deduplicate.py -h
Each script has a command-line help available with arg -h, explaining how to set parameters.
You may also execute the scheduled job manually:
$ ./scripts/execPy.sh /work/manual_job.py
Content type
Image
Digest
sha256:741dcf856…
Size
81.8 MB
Last updated
over 1 year ago
docker pull ahuh/pyphotorg