foto.sh

Foto takes some images produced by Aperture, and applies this site’s standard EXIF text. It uses mogrify and exiftool to do so. It presumes it’s in the image parent directory. It presumes the directory structure follows the arts & ego norm.

The script changes the image EXIF to throw away a lot of useful technical data and replace it with a full blast of the final word of this site’s name. It’s about time I did a bit more work on that aspect of here.

So here’s the script:

cd pictures
mogrify -size 100x60 -fill grey -stroke white -font KabelLTStd-Book -pointsize 36 -gravity southeast -draw "text 0,0 \"example.org \"" -kerning 2 *.jpg
exiftool -@ ~/exif.txt -overwrite_original *.jpg
cd ../thumbnails
exiftool -@ ~/exif.txt -overwrite_original *.jpg
cd ..

image: concrete

And here’s an example EXIF:

-all=
-EXIF:Artist=David Example
-EXIF:ProcessingSoftware=Apple Aperture
-EXIF:Copyright=(c) 1984-2084 David Example, example.com
-EXIF:CreateDate=2020-04-01 00:00:00
-IPTC:Country-PrimaryLocationCode=LUX
-IPTC:City=
-IPTC:Credit=David Example
-IPTC:Contact=David Example, email@example.com, mail@example.com
-IPTC:DateCreated=2020:04:01
-IPTC:CopyrightNotice=(c) 1984-2084 David Example, example.com
-XMP-cc:AttributionName=David Example
-XMP-cc:AttributionURL=https://example.com/
-XMP-cc:Jurisdiction=https://luxcommons.lu/
-XMP-cc:LegalCode=https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
-XMP-cc:License=https://creativecommons.org/licenses/by-nc-sa/4.0/
-XMP-cc:MorePermissions=https://example.com/
-XMP-cc:Permits+=Reproduction
-XMP-cc:Permits+=Distribution
-XMP-cc:Permits+=Derivative Works
-XMP-cc:Prohibits+=Commercial Use
-XMP-cc:Requires+=Notice
-XMP-cc:Requires+=Attribution
-XMP-cc:Requires+=Share Alike
-XMP-dc:Creator=David Example
-XMP-dc:Date=2020-04-01
-XMP-dc:Description=This photograph was prepared by David Example for his website, at www.example.com.
-XMP-iptcCore:CountryCode=LU
-XMP-iptcCore:CreatorCity=Orciny
-XMP-iptcCore:CreatorCountry=Luxembourg
-XMP-iptcCore:CreatorWorkEmail=email@example.com
-XMP-iptcCore:CreatorWorkURL=https://example.com/
-XMP-iptcCore:CreatorWorkEmail=email@example.com
-XMP-iptcCore:CreatorWorkURL=https://example.com/
-XMP-iptcExt:ArtworkContentDescription=This photograph was prepared by David Example for his website, at www.example.com.
-XMP-iptcExt:ArtworkCopyrightNotice=(c) 1984-2084 David Example, example.com
-XMP-iptcExt:ArtworkCopyrightOwnerName=David Example
-XMP-iptcExt:ArtworkCreator=David Example
-XMP-iptcExt:CopyrightYear=2020
-XMP-iptcExt:CreatorName=David Example
-XMP-iptcExt:LocationCreatedCity=Orciny
-XMP-iptcExt:LocationCreatedCountryCode=LU
-XMP-iptcExt:LocationCreatedCountryName=Grand Duchy of Luxembourg
-XMP-plus:TermsAndConditionsURL=https://example.com/
-XMP-pmi:ContactInfo=David Example, email@example.com, mail@example.com
-XMP-prism:BlogTitle=blog
-XMP-prism:BlogURL=https://example.com/
-XMP-prism:CopyrightYear=2020
-XMP-prism:CreationDate=2020-04-01 00:00:00
-XMP-pur:Copyright=(c) 1984-2084 David Example, example.com
-XMP-pur:CreditLine=David Example
-XMP-pur:ReuseProhibited=False
-XMP-pur:RightsOwner=David Example
-XMP-xmp:Author=David Example
-XMP-xmp:BaseURL=https://example.com/
-XMP-xmp:Description=This photograph was prepared by David Example for his website, at www.example.com.
-XMP-xmp:CreateDate=2020-04-01
-XMP-xmp:Keywords=photography,David Example,example.com
-XMP-xmpRights:Marked=True
-XMP-xmpRights:UsageTerms=This work is licensed to the public under the Creative Commons Attribution-ShareAlike licence https://creativecommons.org/licenses/by-nc-sa/4.0/ ; more details at https://example.com/
-XMP-xmpRights:Owner=David Example


cpfoto.sh

Cpfoto.sh copies a general language photoset into a series of specific language versions. It presumes it’s in a photoset parent directory (e.g. foto, photographs, etc.).


#!/bin/sh
#

if [[ -z "$8" ]] ; then
  echo "./cpfoto.sh orig-title german-title french-title lux-title dutch-title english-title run-dir orig-foto-dir"
  exit
fi

if [[ ! -d "$7" ]] ; then
  echo "cannot find $7"
  exit
fi

cd $7

if [[ ! -d "foto/$8" ]] ; then
  echo "cannot find foto/$8"
  exit
fi

if [[ ! -e  "foto/$8/index.shtml" ]] ; then
  echo "foto/$8 is empty"
  exit
fi

mkdir en/foto/$8
mkdir de/foto/$8
mkdir fr/foto/$8
mkdir lb/foto/$8
mkdir nl/foto/$8

cp foto/$8/*.shtml en/foto/$8
cp foto/$8/*.shtml de/foto/$8
cp foto/$8/*.shtml fr/foto/$8
cp foto/$8/*.shtml lb/foto/$8
cp foto/$8/*.shtml nl/foto/$8

cd de/foto/$8
sed -i "" -e "s~/en/~/de/~g" *.shtml
sed -i "" -e "s~$1~$2~" *.shtml
#sed -i "" -e "s~src=\"thumbnails~src=\"/foto/$8/thumbnails~"  -e "s~src=\"pictures~src=\"/foto/$8/pictures~" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/de/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..

cd fr/foto/$8
sed -i "" -e "s~/en/~/fr/~g" *.shtml
sed -i "" -e "s~$1~$3~" *.shtml
#sed -i "" -e "s~src=\"thumbnails~src=\"/foto/$8/thumbnails~"  -e "s~src=\"pictures~src=\"/foto/$8/pictures~" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/fr/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..

cd lb/foto/$8
sed -i "" -e "s~/en/~/lb/~g" *.shtml
sed -i "" -e "s~$1~$4~" *.shtml
#sed -i "" -e "s~src=\"thumbnails~src=\"/foto/$8/thumbnails~"  -e "s~src=\"pictures~src=\"/foto/$8/pictures~" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/lb/plumbing/html-end~/plumbing/html-end~"  *.shtml
p4 add *.shtml
cd ../../..

cd nl/foto/$8
sed -i "" -e "s~/en/~/nl/~g" *.shtml
sed -i "" -e "s~$1~$5~" *.shtml
#sed -i "" -e "s~src=\"thumbnails~src=\"/foto/$8/thumbnails~"  -e "s~src=\"pictures~src=\"/foto/$8/pictures~" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/nl/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..

cd en/foto/$8
sed -i "" -e "s~$1~$6~" *.shtml
#sed -i "" -e "s~src=\"thumbnails~src=\"/foto/$8/thumbnails~"  -e "s~src=\"pictures~src=\"/foto/$8/pictures~" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/en/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..


cpfoto2.sh

Cpfoto2.sh is a variant of cpfoto.sh (above), for use when a photoset’s title is identical across all languages.


#!/bin/sh
#END)

if [[ -z "$1" ]] ; then
  echo $1
  echo "cpfoto.sh dir"
  echo "NOTE: use cpfoto if changing title"
  exit
fi

if [[ ! -d "foto/$1" ]] ; then
  echo "cannot find foto/$1"
  exit
fi

if [[ ! -e  "foto/$1/index.shtml" ]] ; then
  echo "foto/$1 is empty"
  exit
fi

mkdir en/foto/$1
mkdir de/foto/$1
mkdir fr/foto/$1
mkdir lb/foto/$1
mkdir nl/foto/$1

cp foto/$1/*.shtml en/foto/$1
cp foto/$1/*.shtml de/foto/$1
cp foto/$1/*.shtml fr/foto/$1
cp foto/$1/*.shtml lb/foto/$1
cp foto/$1/*.shtml nl/foto/$1

cd de/foto/$1
sed -i "" -e "s~/en/~/de/~g" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/de/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..

cd fr/foto/$1
sed -i "" -e "s~/en/~/fr/~g" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/fr/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..

cd lb/foto/$1
sed -i "" -e "s~/en/~/lb/~g" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/lb/plumbing/html-end~/plumbing/html-end~"  *.shtml
p4 add *.shtml
cd ../../..

cd nl/foto/$1
sed -i "" -e "s~/en/~/nl/~g" *.shtml
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/nl/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..

cd en/foto/$1
sed -i "" -e "s~<\!--\#include virtual=\"/plumbing/var.inc\" -->~&<\!--\#include virtual=\"/plumbing/var.inc\" -->~" *.shtml
sed -i "" -e "s~virtual=\"/foto~virtual=\"/foto~g" -e "s~ virtual=\"/plumbing/html~ virtual=\"/plumbing/html~g" -e "s~/en/plumbing/html-end~/plumbing/html-end~" *.shtml
p4 add *.shtml
cd ../../..


See site: [ introduction, site.sh, utilities ].


I now also use the static site checker to prepare arts & ego.