diff options
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-x | localvideowebencode | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/localvideowebencode b/localvideowebencode index e49999e..cb4b2e1 100755 --- a/localvideowebencode +++ b/localvideowebencode @@ -15,6 +15,20 @@ exit1() { exit 1 } +PRG=$(basename "$0") + +# parse cmdline options +TEMP="`getopt -s sh -o s:t: -l size:,title: -n "$PRG" -- "$@"`" || exit1 "Internal getopt error." +eval set -- "$TEMP" +while true ; do + case "$1" in + -s|--size) size="$2"; shift 2;; + -t|--title) title="$2"; shift 2;; + --) shift; break;; + *) exit1 "Internal error resolving options.";; + esac +done + # input filename (mandatory) infile="$1"; shift || exit1 "Input file missing!" filebase=$(echo "$infile" | perl -pe 's/\.[^.]*//') @@ -22,13 +36,12 @@ 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 || exit1 "Unknown output size!" +[ -n "$size" ] || exit1 "Unknown output size!" width=$(echo "$size" | perl -pe 's/[^x]*x//') height=$(echo "$size" | perl -pe 's/x[^x]*//') heightplus=${height:+$(($height+4))} # fallback graphics title -# TODO: implement --title option (set it in environment for now) title=${title:-$filebase} # TODO: Check and fail if all needed tools are not available |