From 287aa4989d4cbdc2849a05c1c70301db26c16841 Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Mon, 17 Aug 2015 09:23:16 +0200 Subject: [PATCH] [exiv2-common-edits] Initial commit on project See exiv2-common-edits for details on the project. The script as such is added and the Makefile is updated. --- Makefile | 1 + exiv2-common-edits | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 exiv2-common-edits diff --git a/Makefile b/Makefile index 8fc6a36..e023745 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ INSTALL = $(HOME)/bin scripts = \ msmtp-notify \ repo-encrypt \ +exiv2-common-edits \ bash-completion = \ repo-encrypt \ diff --git a/exiv2-common-edits b/exiv2-common-edits new file mode 100755 index 0000000..8967dc3 --- /dev/null +++ b/exiv2-common-edits @@ -0,0 +1,47 @@ +#!/bin/bash + +# Script that issues group edits of image files + +filevar="/tmp/${0##*/}-$$-a" +fileexiv="/tmp/${0##*/}-$$-b" +fullname=$(getent passwd $USER | cut -d : -f 5 | cut -d , -f 1) + +echo "photographer=\"$fullname\" +cameraowner=\"$fullname\" +description=\"\" +copyright=\"Creative Commons Attribution Share Alike 4.0 (http://creativecommons.org/licenses/by-sa/4.0)\" +copyrightshort=\"CC BY-SA 4.0\" +" > "$filevar" + +if ! $EDITOR "$filevar"; then exit 1; fi + +source "$filevar" + +if [ "$cameraowner" == "$photographer" ]; then + echo "set Exif.Image.Artist 'Photographer, $photographer'" >> "$fileexiv" + echo "set Iptc.Application2.Byline '$photographer ($copyrightshort)'" >> "$fileexiv" + echo "" >> "$fileexiv" + echo "set Exif.Image.Copyright 'Copyright, $photographer $(date +'%Y'). $copyright'" >> "$fileexiv" +else + echo "set Exif.Image.Artist 'Camera owner, $cameraowner; Photographer, $photographer'" >> "$fileexiv" + echo "set Iptc.Application2.Byline '$photographer and $cameraowner ($copyrightshort)" >> "$fileexiv" + echo "" >> "$fileexiv" + echo "set Exif.Image.Copyright 'Copyright, $photographer and $cameraowner, $(date +'%Y'). $copyright'" >> "$fileexiv" +fi +if [ "$description" ]; then + echo "" >> "$fileexiv" + echo "set Exif.Photo.UserComment '$description'" >> "$fileexiv" + echo "" >> "$fileexiv" + echo "set Iptc.Application2.Caption '$description'" >> "$fileexiv" +fi + +if ! $EDITOR "$fileexiv"; then exit 1; fi + +for f in "$@"; do + exiv2 -m "$fileexiv" "$f" +done + +echo "Verify with" +echo "exiv2 -p a -g Exif.Image.Artist -g Exif.Image.Copyright -g Exif.Photo.UserComment -g Iptc.Application2.Byline -g Iptc.Application2.Caption $@" + +rm -f "$filevar" "$fileexiv" -- 2.39.5