X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=helpers%2Fgenthumb.sh;h=9a0c64ad96ba7f12988caace7eafecf2b2f5e67c;hb=6b08e359a06ed38d25c1756e5600096c77417a9c;hp=78f53c140c472567e998140e7cc6c1f3f93e802a;hpb=8d001b4467b644b462faabdf75d8f6af50c4e2ae;p=serve0 diff --git a/helpers/genthumb.sh b/helpers/genthumb.sh index 78f53c1..9a0c64a 100755 --- a/helpers/genthumb.sh +++ b/helpers/genthumb.sh @@ -1,10 +1,26 @@ #!/bin/zsh +# Copyright 2014 - 2016 Paul Hänsch +# +# This file is part of Serve0 +# +# Serve0 is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Serve0 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Serve0 If not, see . video="$1" thumb="$2" if [ -e "$video" -a \! -e "$thumb" ]; then - echo '' |mplayer -input nodefault-bindings -nosound -vo null -frames 0 -identify "$video" \ + printf '' |mplayer -input nodefault-bindings -nosound -vo null -frames 0 -identify "$video" \ | sort \ | sed -rn 's:^.*ID_LENGTH=(.*)(\..*)$:\1:p; s:^.*ID_VIDEO_HEIGHT=(.*)$:\1:p; @@ -19,7 +35,7 @@ if [ -e "$video" -a \! -e "$thumb" ]; then tmp="$(mktemp -d)" for cnt in 1 2 3 4; do - echo '' |mplayer -input nodefault-bindings -nosound -vo jpeg:outdir="$tmp" -frames 1 \ + printf '' |mplayer -input nodefault-bindings -nosound -vo jpeg:outdir="$tmp" -frames 1 \ -benchmark -vf framestep=I,scale="$width":-2 -ss "$(($cnt*$chunk))" "$video" >/dev/null 2>/dev/null mv "$tmp/00000001.jpg" "${tmp}/_${cnt}.jpg" done