From fafc904d0e8b5a76577f16700c123af684176fdc Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Mon, 2 Sep 2013 09:41:42 -0400 Subject: Don't overwrite files when encoding. --- iencode.sh | 11 ++++++++++- vencode.sh | 4 ++-- www/css/index.css | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/iencode.sh b/iencode.sh index 990d027..460db3b 100755 --- a/iencode.sh +++ b/iencode.sh @@ -5,6 +5,8 @@ CWEBP=cwebp # configure flags CWEBP_FLAGS="-m 6" +set -e + cd $(dirname $0)/www/dump iencode() { @@ -15,9 +17,16 @@ iencode() { find . -name \*."${EXT}" -print0 | xargs -0 -P ${THREADS} -n 1 bash -c ' IN="$0" OUT="${IN%.${EXT}}.webp" - ${CWEBP} -q "${QUAL}" ${CWEBP_FLAGS} ${IN} -o ${OUT} + [[ -f ${OUT} ]] || ${CWEBP} -q "${QUAL}" ${CWEBP_FLAGS} ${IN} -o ${OUT} ' } iencode jpg 90 iencode png 99 + +if hash zopflipng; then + find . -name \*.png -print0 | xargs -0 -I '{}' -P ${THREADS} zopflipng -my '{}' '{}' +else + echo >&2 "Install zopfli (https://code.google.com/p/zopfli/) to improve PNG compression." + echo >&2 "Approximately 2% savings can be seen across the board, with no cost to quality." +fi diff --git a/vencode.sh b/vencode.sh index d29b52c..aff9f4c 100755 --- a/vencode.sh +++ b/vencode.sh @@ -3,7 +3,7 @@ # configure ffmpeg location if not in PATH FFMPEG=ffmpeg # configure flags -FFMPEG_FLAGS="-y" +FFMPEG_FLAGS="" set -e @@ -11,7 +11,7 @@ cd $(dirname $0)/www/dump/video vencode() { set -x - ${FFMPEG} -threads ${THREADS} -i "$1" -c:v "$2" $3 ${FFMPEG_FLAGS} "$4" + [[ -f $4 ]] || ${FFMPEG} -threads ${THREADS} -i "$1" -c:v "$2" $3 ${FFMPEG_FLAGS} "$4" } for f in *.mkv; do diff --git a/www/css/index.css b/www/css/index.css index 6d1264c..fba9bf3 100644 --- a/www/css/index.css +++ b/www/css/index.css @@ -156,6 +156,7 @@ html.no-js #gotit { } #nvlctc { bottom: 25px; + transform: rotate(90deg); } #centered { text-align: center; -- cgit v1.2.3-54-g00ecf