#!/usr/bin/awk -f
#
# Replace (or add) URLs for icons of my photos.
#
# If the IMG SRC is a YYYY.MM.DD-HH.MM.SS.jpg (or .png) filename, the likely location
# of the original image will be ../photos/YYYY/MM/YYYY.MM.DD-HH.MM.SS.jpg
# and it's webpage will be ../photos/YYYY/MM/YYYY.MM.DD-HH.MM.SS.html
# (although sometimes a month will have day subdirectories).
#
# Brent Chivers 2012/Aug/27
#
# Sample entries to update:
#
# netSnapShot -- can't do this one, because SRC has date but not time.
#
#
# Ordinary atpic entry
#
#
# Same atpic entry, but icon replaced jpg with png
#
#
# Multiple icons cropped from same photo
#
#
# Icon created without link after giving up on atpic.com
#
#
# Manually-linked icon (should be changed to the same thing)
#
#
#
# photo icon with netSnapShot or atpic link -- replace link (closing tag already there)
#
/
", year, month, year, month, day, hour, minute, second)
printf ("%s\n", substr($0, img))
next }
#
# photo icon without link -- add link and closing tag
#
/^
", year, month, year, month, day, hour, minute, second)
printf ("%s\n", substr($0, img))
next }
#
# netSnapShot- or atpic-linked photo icon with date but not time
# old links are useless, so replace link with incomplete path
#
/
", year, month, year, month, day)
printf ("%s\n", substr($0, img))
next }
#
# netSnapShot- or atpic-linked photo icon with probable date but not time
# old links are useless, so replace link with incomplete path
#
/
", year, month, year, month, day)
printf ("%s\n", substr($0, img))
next }
#
# unlinked photo icon with date but not time -- guess at link with incomplete path
#
/^
", year, month, year, month, day)
printf ("%s\n", substr($0, img))
next }
#
# unlinked photo icon with probable date but not time -- guess at link with incomplete path
#
/^
", year, month, year, month, day)
printf ("%s\n", substr($0, img))
next }
# print everything else
{ print }