#!/bin/bash
#
# iptc_tag_qnd.sh
#
# Version : 0.1
# Latest version is always available at http://www.ruwenzori.net/code/iptc_tag_qnd/
#
# What :
# The trivial, quick and dirty way to tag a bunch of JPEG files with
# the generic IPTC metadata of your choice.
#
# How :
# Edit the script to your taste.
#
# Dependancies :
# - exiv2
#
# Author : Jean-Marc Liotier
#
# Changelog :
# 0.1   20061117        Initial version
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.

iptc_data_temp_file=.iptc.txt.tmp

rm -f $iptc_data_temp_file
touch $iptc_data_temp_file

echo add Iptc.Application2.Keywords \"key words  \" >> $iptc_data_temp_file
echo add Iptc.Application2.Headline \"Just another picture by me\" >> $iptc_data_temp_file
echo add Iptc.Application2.Caption \"This is what happens in the picture and maybe some context\" >> $iptc_data_temp_file
echo add Iptc.Application2.SpecialInstructions \"Free for non-commercial use as long as Jean-Marc Liotier is cited as the author. For commercial use please contact the author\" >> $iptc_data_temp_file
echo add Iptc.Application2.Source gallery.ruwenzori.net >> $iptc_data_temp_file
echo add Iptc.Application2.Credit \"Jean-Marc Liotier\" >> $iptc_data_temp_file
echo add Iptc.Application2.Contact \"jim@liotier.org\" >> $iptc_data_temp_file
echo add Iptc.Application2.Copyright Jean-Marc Liotier, all rights reserved >> $iptc_data_temp_file
echo add Iptc.Application2.Byline \"Copyright Jean-Marc Liotier\" >> $iptc_data_temp_file
echo add Iptc.Application2.City \"Paris\" >> $iptc_data_temp_file
echo add Iptc.Application2.CountryCode \"FR\" >> $iptc_data_temp_file
echo add Iptc.Application2.CountryName \"France\" >> $iptc_data_temp_file
echo add Iptc.Application2.ProvinceState FR >> $iptc_data_temp_file
echo add Iptc.Application2.ReleaseDate 2006-11-19 >> $iptc_data_temp_file
echo add Iptc.Application2.DateCreated 2006-11-15 >> $iptc_data_temp_file

find . -maxdepth 1 -type f | grep -i .jpg | while read zefile
  do
   exiv2 -m $iptc_data_temp_file $zefile
   chmod 644 $zefile
  done

rm -f $iptc_data_temp_file