diff --git a/2minNoods.sh b/2minNoods.sh index 4aa0b3a..dd3f934 100755 --- a/2minNoods.sh +++ b/2minNoods.sh @@ -1,10 +1,16 @@ #!/bin/bash -mkdir -p siteroot +siteroot="../2minNoods_siteroot" +noodspp=40 + + +mkdir -p "$siteroot/img/thumbs" +pageno=1 +noodcount=1 + # html and css stolen from https://perfectmotherfuckingwebsite.com/ -cat < siteroot/index.html - +pageheader=''' @@ -21,7 +27,18 @@ body{ color:#444 } h1,h2,h3{ - line-height:1.2 + line-height:1 +} +.page-links{ + font-size: 2em; +} +a.button{ + padding: 1px 6px; + border: 1px outset buttonborder; + border-radius: 3px; + color: buttontext; + background-color: buttonface; + text-decoration: none; } @media (prefers-color-scheme: dark){ body{ @@ -40,25 +57,43 @@ h1,h2,h3{

2minNoods

-
-EOF +
''' -ls *.jpg | sort -r > photolist.txt +rm -v "$siteroot"/index.*.html + +echo '' > "$siteroot/index.html" + +ls *.jpg | sort -k2 -t'_' -r > "$siteroot/photolist.txt" while read i; do if [ -f "$i" ]; then - if [ ! -f "siteroot/$i" ]; then + if [ ! -f "$siteroot/img/$i" ]; then echo "Resizing $i" - convert "$i" -quality 80 -strip -auto-orient -resize "2160^>" "siteroot/$i" + convert "$i" -quality 70 -strip -auto-orient -resize "960^>" "$siteroot/img/thumbs/$i" + convert "$i" -quality 90 -strip -auto-orient -resize "2160^>" "$siteroot/img/$i" + fi + if [[ $noodcount -eq 1 ]]; then + echo "$pageheader" > "$siteroot/index.$pageno.html" + fi + echo '

'"$(basename $i .jpg)"'


' >> "$siteroot/index.$pageno.html" + ((noodcount++)) + if [[ $noodcount -gt $noodspp ]]; then + ((pageno++)) + noodcount=1 fi - echo '

'"$(basename $i .jpg)"'

' >> siteroot/index.html - echo '
' >> siteroot/index.html fi -done < photolist.txt +done < "$siteroot/photolist.txt" -cat <> siteroot/index.html - - -EOF +for ((page=1;page<=pageno;page++)); do + echo -n '' >> "$siteroot/index.$page.html" +done -rm photolist.txt +rm -v "$siteroot/photolist.txt"