diff options
Diffstat (limited to '')
-rw-r--r-- | www/photo.causal.agency/generate.sh | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/www/photo.causal.agency/generate.sh b/www/photo.causal.agency/generate.sh index 4b30db92..26279229 100644 --- a/www/photo.causal.agency/generate.sh +++ b/www/photo.causal.agency/generate.sh @@ -15,14 +15,14 @@ resize() { preview() { local photo=$1 local preview=preview/${photo##*/} - resize $photo 25% static/$preview + resize $photo 1500000@ static/$preview echo $preview } thumbnail() { local photo=$1 local thumbnail=thumbnail/${photo##*/} - resize $photo 5% static/$thumbnail + resize $photo 60000@ static/$thumbnail echo $thumbnail } @@ -41,6 +41,29 @@ page_title() { page_head() { local date=$1 local title=$(page_title $date) + local body lens film + + if test -f $date/body; then + body=$(encode $date/body) + fi + if test -f $date/lens; then + lens=$(encode $date/lens) + else + lens=$( + identify -format '%[EXIF:LensModel]' \ + $date/$(ls -1 $date | head -n 1) 2>/dev/null | + sed ' + s/\([A-Z]\)\([0-9]\)/\1 \2/ + s,f/,ƒ/, + s/\([0-9]\)-\([0-9]\)/\1–\2/g + ' | + encode + ) + fi + if test -f $date/film; then + film=$(encode $date/film) + fi + cat <<-EOF <!DOCTYPE html> <meta charset="utf-8"> @@ -48,12 +71,14 @@ page_head() { <link rel="alternate" type="application/atom+xml" href="../feed.atom"> <title>${title}</title> <style> - html { color: #bbb; background-color: black; font-family: sans-serif; } + html { color: #bbb; background-color: black; font-family: monospace; } + p { text-align: center; } figure { margin: 1em; padding-top: 0.5em; text-align: center; } img { max-width: calc(100vw - 2.5em); max-height: calc(100vh - 2.5em); } details { max-width: 78ch; margin: 0.5em auto; } </style> <h1>${title}</h1> + <p>📷 ${body:-}${body:+ · }${lens}${film:+ 🎞️ }${film:-}</p> EOF } @@ -89,10 +114,16 @@ page_photo() { <img src="../${preview}" alt="$(encode $description)"> </a> <figcaption> + EOF + if test -n "${ExposureTime}"; then + cat <<-EOF ${ExposureTime} · ƒ/$(bc -S 1 -e ${FNumber}) · $(bc -e ${FocalLength}) mm · ${PhotographicSensitivity} ISO + EOF + fi + cat <<-EOF <details> <summary>description</summary> $(encode $description) @@ -183,12 +214,12 @@ for date in 20*; do if ! test -f $page; then echo $page >&2 page_head $date >$page - for photo in ${date}/*.JPG; do + for photo in ${date}/*.[Jj][Pp][Gg]; do preview=$(preview $photo) if ! test -f static/${photo}; then ln $photo static/${photo} fi - page_photo $photo $preview ${photo%.JPG}.txt >>$page + page_photo $photo $preview ${photo%.[Jj][Pp][Gg]}.txt >>$page done fi set -- $date "$@" @@ -201,7 +232,7 @@ atom_head >static/feed.atom for date; do index_page $date >>static/index.html atom_entry_head $date >>static/feed.atom - for photo in ${date}/*.JPG; do + for photo in ${date}/*.[Jj][Pp][Gg]; do thumbnail=$(thumbnail $photo) index_photo $date $photo $thumbnail >>static/index.html index_photo $date $photo $thumbnail $Root | encode >>static/feed.atom |