From 5562aba17255c674b08d64f7e55dc85a9add099d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 7 Sep 2010 16:18:44 +0200 Subject: Add exit1 function, and explain some failures. --- localvideowebencode | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/localvideowebencode b/localvideowebencode index 7aaca47..e49999e 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -9,14 +9,20 @@ set -e +exit1() { + response="${1:+Error: }${1:-Internal error!}" + echo >&2 "$response" + exit 1 +} + # input filename (mandatory) -infile="$1"; shift +infile="$1"; shift || exit1 "Input file missing!" filebase=$(echo "$infile" | perl -pe 's/\.[^.]*//') # output size in WIDTHxHEIGHT (mandatory) # TODO: Make optional with input size as default # TODO: Make each half of size optional with default resolved from input aspect ratio -size="$1"; shift +size="$1"; shift || exit1 "Unknown output size!" width=$(echo "$size" | perl -pe 's/[^x]*x//') height=$(echo "$size" | perl -pe 's/x[^x]*//') heightplus=${height:+$(($height+4))} -- cgit v1.2.3