#!/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. # Andrea, March 2005 # # Ordinary atpic entry # Pennsic 37 Blood-Donor token, Pennsic 2008 # # Same atpic entry, but icon replaced jpg with png # Pennsic 37 Blood-Donor token, Pennsic 2008 # # Multiple icons cropped from same photo # Maugorn, Hastings re-enactment, 2005 # # Icon created without link after giving up on atpic.com # fused glass pendant in sterling silver setting, Pennsic XLI (2012) # # Manually-linked icon (should be changed to the same thing) # fused glass, Pennsic XLI (2012) # # # 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 }