bug in multiple args

This commit is contained in:
Ville Rantanen
2021-12-27 16:57:39 +02:00
parent 743d6946b8
commit e342fb488f

View File

@@ -116,6 +116,7 @@ preset="compress"
overwrite="" overwrite=""
if [[ -z "$1" ]]; then helpexit; fi if [[ -z "$1" ]]; then helpexit; fi
argcount=0
for (( i=1; i<=$#; i++ )); do for (( i=1; i<=$#; i++ )); do
[[ ${!i} = "-h" ]] && helpexit [[ ${!i} = "-h" ]] && helpexit
[[ ${!i} = "-low" ]] && { [[ ${!i} = "-low" ]] && {
@@ -124,27 +125,27 @@ for (( i=1; i<=$#; i++ )); do
abit=64 abit=64
resize="-s hd480" resize="-s hd480"
preset="low" preset="low"
shift 1 argcount=$(( argcount + 1 ))
} }
[[ ${!i} = "-med"* ]] && { [[ ${!i} = "-med"* ]] && {
FORCE=1 FORCE=1
crf=23 crf=23
abit=96 abit=96
preset="med" preset="med"
shift 1 argcount=$(( argcount + 1 ))
} }
[[ ${!i} = "-high" ]] && { [[ ${!i} = "-high" ]] && {
FORCE=1 FORCE=1
crf=18 crf=18
abit=128 abit=128
preset="high" preset="high"
shift 1 argcount=$(( argcount + 1 ))
} }
[[ ${!i} = "-yify" ]] && { [[ ${!i} = "-yify" ]] && {
FORCE=1 FORCE=1
YIFY_PRESET=1 YIFY_PRESET=1
preset="yify" preset="yify"
shift 1 argcount=$(( argcount + 1 ))
} }
[[ ${!i} = "-custom"* ]] && { [[ ${!i} = "-custom"* ]] && {
FORCE=1 FORCE=1
@@ -156,14 +157,14 @@ for (( i=1; i<=$#; i++ )); do
if [[ -n "$resize" ]]; then if [[ -n "$resize" ]]; then
resize="-s $resize" resize="-s $resize"
fi fi
shift 1 argcount=$(( argcount + 1 ))
} }
[[ ${!i} = "-y" ]] && { [[ ${!i} = "-y" ]] && {
overwrite="-y" overwrite="-y"
shift 1 argcount=$(( argcount + 1 ))
} }
done done
shift $argcount
compression="-g 250 -c:v libx264 -crf $crf" compression="-g 250 -c:v libx264 -crf $crf"
audio="-c:a aac -ar 44100 -b:a ${abit}k -strict -2" audio="-c:a aac -ar 44100 -b:a ${abit}k -strict -2"
if [[ "$YIFY_PRESET" -eq 1 ]]; then if [[ "$YIFY_PRESET" -eq 1 ]]; then