GjjvdBurg / HugoPhotoSwipe

Command-line tool for easy PhotoSwipe galleries in Hugo
https://gertjanvandenburg.com/blog/hugophotoswipe/
GNU General Public License v3.0
128 stars 15 forks source link

Implement minimal EXIF/IPTC tag support #32

Closed sebastiaan-lampo closed 2 years ago

sebastiaan-lampo commented 3 years ago

Use PIL's TAGS to deal with EXIF. Use iptcinfo3 to deal with IPTC tags. Allows to use these as fallback options for copyright and caption of photos. As a sample use-case reads captions from the photos and the album copyright can be determined from the copyright of the photos in it. Will not change the default behaviour without adding the setting tag_map, exif or iptc to the configuration file. If the copyright use-case is not desired, drop the changes to the album.py file in their entirety.

To make it work more easily, without constant try except clauses for every setting possible, the Settings object now returns None when accessing a property that is not set instead of throwing an AttributeError. I left this fundamental change to the codebase as a separate commit but not changing this behaviour will require a re-write of some code in this pull request.

This feature is the baseline for integrating with #31 to output EXIF/IPTC tags into the front matter of every photo.

GjjvdBurg commented 3 years ago

Thanks a lot for these PRs @sebastiaan-lampo! I'll try to make sure to take a detailed look at them as soon as possible.

sebastiaan-lampo commented 3 years ago

If you like both features Gertjan then I can replace these PR's with another one in which I've merged both branches and implemented combined both features. I didn't just want to assume that you consider them good broad use cases.