diff --git a/photos/import.sh b/photos/import.sh index bf576f6..eed9967 100755 --- a/photos/import.sh +++ b/photos/import.sh @@ -151,6 +151,7 @@ do ;; esac done +shift "$((OPTIND-1))" if [ "x${TITLE}" != "x" ] then @@ -196,18 +197,18 @@ add_file() g_files+=("${file}") } -for rsrc in `seq $OPTIND $#` +for rsrc in "$@" do - if [ -f "${!rsrc}" ] + if [ -f "${rsrc}" ] then - add_file ${!rsrc} - elif [ -d "${!rsrc}" ] + add_file "${rsrc}" + elif [ -d "${rsrc}" ] then - echo "Recursing into '${!rsrc}'" + echo "Recursing into '${rsrc}'" while read file do add_file ${file} - done < <(find "${!rsrc}" -type f | sort) + done < <(find "${rsrc}" -type f | sort) fi done diff --git a/photos/prepare-for-web.sh b/photos/prepare-for-web.sh index 0beffd4..401b398 100755 --- a/photos/prepare-for-web.sh +++ b/photos/prepare-for-web.sh @@ -87,17 +87,18 @@ do ;; esac done +shift "$((OPTIND-1))" echo "Output size set to ${size}" echo "Output jpeg quality set to ${quality}" -for img in `seq $OPTIND $#` +for img in "$@" do - if [ -f "${!img}" ] + if [ -f "${img}" ] then - prepare "${!img}" $size $border $sign $quality + prepare "${img}" $size $border $sign $quality else - echo "warning : ${!img} does not exists" + echo "warning : ${img} does not exists" fi done diff --git a/video-convert.sh b/video-convert.sh index 6cc8e7f..e82a258 100755 --- a/video-convert.sh +++ b/video-convert.sh @@ -29,14 +29,16 @@ do ;; esac done +shift "$((OPTIND-1))" count=0 -intput="" +intput=() vids="" concat="" -for arg in `seq $OPTIND $#` +for arg in "$@" do - input="$input -i ${!arg}" + input[$((2*$count))]="-i" + input[$((2*$count+1))]=${arg} if [ x"$scale" != x"" ] ; then vids="$vids [$count:v:0] scale=$scale:$scale:force_original_aspect_ratio=decrease [v$count] ;" concat="$concat [v$count] [$count:a:0]" @@ -50,5 +52,5 @@ if [ x"$rate" != x"" ] ; then rate="-r $rate" fi -ffmpeg "$input" -filter_complex "$filter" -map "[v]" -map "[a]" $rate -c:v libx264 -preset medium -crf $crf -c:a libfdk_aac -b:a 128k -map_metadata 0:g "$output" +ffmpeg "${input[@]}" -filter_complex "$filter" -map "[v]" -map "[a]" $rate -c:v libx264 -preset medium -crf $crf -c:a libfdk_aac -b:a 128k -map_metadata 0:g "$output" # for i in *.mov ; do ~/scripts/video-convert.sh -o ${i/mov/mkv} $i ; done