shithub: img

Download patch

ref: ab5412763ffb95ab14bbe642632e60661fab4aee
parent: 65b0ebdaf6f1ebaf13633c0ac88b1efc6d18195e
parent: df600ad1a1ae4fa31cb31d7e359af803da1c3aff
author: Alex Musolino <musolinoa@gmail.com>
date: Tue Mar 14 10:38:42 EDT 2023

merge

--- a/album.mk
+++ b/album.mk
@@ -1,15 +1,13 @@
 MKSHELL=rc
 
-fullsize=`{ls *.full.JPG >[2]/dev/null}
-bigs=`{ls *.full.JPG | sed 's/\.full\.JPG/.big.JPG/'}
-mediums=`{ls *.full.JPG | sed 's/\.full\.JPG/.medium.JPG/'}
-smalls=`{ls *.full.JPG | sed 's/\.full\.JPG/.small.JPG/'}
-thumbs=`{ls *.full.JPG | sed 's/\.full\.JPG/.thumb.JPG/'}
-n=`{ls *.full.JPG | wc -l}
+fullsize=`{ls *.full.* >[2]/dev/null}
+bigs=`{ls *.full.* | sed 's/\.full\.[A-Z]\+/.big.JPG/'}
+mediums=`{ls *.full.* | sed 's/\.full\.[A-Z]\+/.medium.JPG/'}
+smalls=`{ls *.full.* | sed 's/\.full\.[A-Z]\+/.small.JPG/'}
+thumbs=`{ls *.full.* | sed 's/\.full\.[A-Z]\+/.thumb.JPG/'}
+n=`{ls *.full.* | wc -l}
 pages=`{seq 1 $n | sed 's/$/.html/'}
 
-cflags=-auto-orient
-
 all:V: bigs mediums smalls thumbs html montage.jpg
 bigs:V: $bigs
 mediums:V: $mediums
@@ -16,8 +14,8 @@
 smalls:V: $smalls
 thumbs:V: $thumbs
 
-%.big.JPG: %.full.JPG
-	convert $prereq -resize 1024 -auto-orient $target
+%.big.JPG:
+	convert $stem^.full.* -resize 1024 -auto-orient $target
 
 %.medium.JPG: %.big.JPG
 	convert $prereq -resize 512 -auto-orient $target
--- a/mkfile
+++ b/mkfile
@@ -1,16 +1,6 @@
 MKSHELL=/bin/rc
 
-years=\
-	2008\
-	2009\
-	2013\
-	2014\
-	2015\
-	2018\
-	2019\
-	2020\
-	2021\
-	2022\
+years=`{ls | grep '^[0-9][0-9][0-9][0-9]$'}
 
 dirs=\
 	moto\
@@ -19,12 +9,12 @@
 	group-shoot\
 	ttc2022\
 
-fullsize=`{find $years $dirs -type f -name '*.full.*'}
+fullsize=`{find $years -type f -name '*.full.*'}
 
-montages=`{echo $years/^montage.jpg $dirs/^montage.jpg}
+montages=`{echo $years/^montage.jpg}
 
 index.html:D: $montages ./mkindex.rc ./mkfile
-	./mkindex.rc $years $dirs >index.html
+	./mkindex.rc $years >index.html
 
 %/montage.jpg: subdirs
 
@@ -33,17 +23,9 @@
 		cd $d
 		mk -f ../year.mk
 	}
-	for(d in $dirs)@{
-		cd $d
-		mk -f ../album.mk
-	}
 
 html clean nuke:V:
 	for(d in $years)@{
 		cd $d
 		mk -f ../year.mk $target
-	}
-	for(d in $dirs)@{
-		cd $d
-		mk -f ../album.mk $target
 	}
--- a/mkmontage.rc
+++ b/mkmontage.rc
@@ -16,7 +16,7 @@
 && ! mkmontage 3 9
 && ! mkmontage 2 4
 && ! mkmontage 1 1){
-	echo 'E: failed to make montage for '^$1 >[1=2]
+	echo 'E: failed to make montage for' `{pwd} >[1=2]
 	exit 1
 }
 exit 0
--- a/mkpages.rc
+++ b/mkpages.rc
@@ -34,7 +34,7 @@
 </html>'
 }
 
-ls *.full.JPG | sed 's/\.full\.JPG//' | awk '{
+ls *.full.* | sed 's/\.full\.[A-Z]\+$//' | awk '{
 	if (buf){
 		i = NR - 1
 		p = i - 1
@@ -41,7 +41,7 @@
 		if(p < 1)
 			p = ""
 		n = i + 1
-		printf "mkpage %s.big.JPG %s.full.JPG ''%s'' ''%s'' >%d.html\n", buf, buf, p, n, i
+		printf "mkpage %s.big.JPG %s.full.* ''%s'' ''%s'' >%d.html\n", buf, buf, p, n, i
 	}
 	buf = $0
 }
@@ -48,5 +48,5 @@
 END{
 	i = NR
 	p = i - 1
-	printf "mkpage %s.big.JPG %s.full.JPG ''%s'' '''' >%d.html\n", buf, buf, p, i
+	printf "mkpage %s.big.JPG %s.full.* ''%s'' '''' >%d.html\n", buf, buf, p, i
 }' | rc
--- a/sdrip/archive.rc
+++ b/sdrip/archive.rc
@@ -1,12 +1,12 @@
 #!/bin/rc
 
-ls *.JPG | awk -F_ '{
+{{ls *.JPG; ls *.HEIC} >[2]/dev/null} | awk -F_ '{
 	year=substr($1, 1, 4)
 	month=substr($1, 5, 2)
 	dirs[sprintf("%s/%s", year, month)] = 1
-	printf "mv -n %s /home/alex/img/%s/%s/%s\n", $0, year, month, $0
+	printf "mv -n %s %s/img/%s/%s/%s\n", $0, ENVIRON["HOME"], year, month, $0
 }
 END{
 	for(d in dirs)
-		printf "mkdir -p /home/alex/img/%s\n", d
+		printf "mkdir -p %s/img/%s\n", ENVIRON["HOME"], d
 }' | tac
--- a/sdrip/rename.rc
+++ b/sdrip/rename.rc
@@ -1,9 +1,9 @@
 #!/bin/rc -e
 
 rename jpg JPG *.jpg >[2]/dev/null || {}
-exiv2 --verbose --Force -t rename *.JPG
+exiv2 --verbose --Force -t rename `{{ls *.JPG; ls *.HEIC} >[2]/dev/null}
 
-sha1sum *.JPG *.jpg >[2]/dev/null | awk '
+sha1sum `{{ls *.JPG; ls *.HEIC} >[2]/dev/null} | awk '
 function quote(s){
 	gsub("''", "''''", s)
 	return sprintf("%s", s)
@@ -11,5 +11,7 @@
 {
 	hash=substr($1, 1, 8)
 	date=substr($2, 1, 15)
-	printf "mv %s %s.%s.full.JPG\n", quote($2), date, hash
+	match($2, ".[A-Z]+$")
+	fext=substr($2, RSTART+1, RLENGTH-1)
+	printf "mv %s %s.%s.full.%s\n", quote($2), date, hash, fext
 }' | rc
--- a/year.mk
+++ b/year.mk
@@ -1,23 +1,9 @@
 MKSHELL=rc
 
-months=\
-	01\
-	02\
-	03\
-	04\
-	05\
-	06\
-	07\
-	08\
-	09\
-	10\
-	11\
-	12\
-
-months=`{ls -d $months >[2]/dev/null}
+months=`{ls | grep '^[0-1][0-9]$' >[2]/dev/null}
 montages=`{ls -d $months | sed 's,$,/montage.jpg,'}
 
-all:V: $montages index.html montage.jpg
+all:V: $montages index.html montage.jpg subdirs
 
 [0-9]+/montage\.jpg:RQ:
 	for(d in $months)@{
@@ -29,10 +15,10 @@
 			status=()
 	}
 
-html:V: index.html
+subdirs:V:
 	for(d in $months)@{
 		cd $d
-		mk -f ../../album.mk $target
+		mk -f ../../album.mk
 	}
 
 index.html: $HOME/img/mkyearidx.rc $montages