Nextcloud Photo Fixer.
A Bash / exiftool / jq pipeline that heals EXIF and filesystem timestamps across a decade of mixed-source photos and videos, so a self-hosted Nextcloud Photos gallery shows them in correct chronological order.
Great project and nice learning experience! Many other users will find this useful.— Nextcloud, on LinkedIn
Source hierarchy.
The pipeline resolves conflicts deterministically by trying sources in priority order. Whatever the highest available source claims is what gets written.
1
Google Takeout JSON sidecars
Original capture timestamps from Google Photos exports — most reliable.
2
In-file EXIF DateTimeOriginal
Whatever the camera or phone recorded at capture time.
3
Filesystem mtime
When no metadata exists — at least the modification time was preserved.
4
Filename heuristics
Last resort — parse "IMG_20180714_133502.jpg" style names.
Behaviour.
Writes a coherent (EXIF, mtime) pair. Idempotent — skips files already
aligned. Logs every decision to /var/log/nextcloud_photo_fix.log
for audit. Targets JPG, JPEG, MP4 and supplemental .json from
Google Takeout. Dependencies: jq,
libimage-exiftool-perl.