diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-09-07 16:18:44 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-09-07 16:18:44 +0200 |
commit | 5562aba17255c674b08d64f7e55dc85a9add099d (patch) | |
tree | 0da3123b06a572db557e669a85ae8b2012647713 | |
parent | 31ebec0399c05f2f1ae9f1b1807f8f3266faed1a (diff) |
Add exit1 function, and explain some failures.
-rwxr-xr-x | localvideowebencode | 10 |
1 files 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))} |