diff --git a/main.c b/main.c index 0fe1108..5474da6 100644 --- a/main.c +++ b/main.c @@ -79,9 +79,7 @@ int findf(Lexicon* l, char* f) { void fpedited(FILE* f, char* path) { struct stat attr; stat(path, &attr); - fputs("", f); - fprintf(f, "Edited on %s ", ctime(&attr.st_mtime)); - fputs("", f); + fprintf(f, "Edited on %s
", ctime(&attr.st_mtime)); } int fpportal(FILE* f, Lexicon* l, char* s, int head) { @@ -283,6 +281,34 @@ int fpinject(FILE* f, Lexicon* l, char* filepath) { return 1; } +int fpfooter(FILE* f, char* name, char* path) { + if (!f || !name || !path) + return 0; + fputs("", f); + return 1; +} + FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) { if (!f) return f; @@ -333,16 +359,12 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) { if (!fpinject(f, l, srcpath)) printf(">>> Building failed: %s\n", name); fputs("\n\n", f); - /* footer */ - fputs("", f); } + /* footer */ + if (!fpfooter(f, name, srcpath)) { + printf(">>> Building failed: footer(%s)\n", name); + } + /* end */ fputs("", f); return f; diff --git a/thumbnailer.sh b/thumbnailer.sh index 2b42774..38334b0 100755 --- a/thumbnailer.sh +++ b/thumbnailer.sh @@ -1,6 +1,5 @@ #!/bin/sh -ROOT=../www SRC=../www/img SIZE=500 @@ -19,27 +18,25 @@ pathtrans() { # generate thumbnails in /img/*/.thumb/ resize() { output=$(pathtrans $1) - if echo $1 | grep .gif > /dev/null; then + if echo $1 | grep -e .gif -e .zip > /dev/null; then return fi if [ ! -f ${output} ]; then - echo "generating thumbnail for $1" + echo "Generating thumbnail for $1" convert $1 -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output} fi } - - if [ -z $1 ]; then echo "usage: $0 [build|clean]" else case $1 in "build") - echo "creating new thumbnails" + echo "Updating thumbnails cache" for x in $(find ${SRC}/*/*); do resize $x; done;; "clean") - echo "cleaning thumbnails cache" + echo "Cleaning thumbnails cache" rm -rf ${SRC}/*/.thumb - echo "cleaned";; + echo "Cleaned";; esac fi