diff --git a/rc_shared.sh b/rc_shared.sh index ffac48c..fa94631 100644 --- a/rc_shared.sh +++ b/rc_shared.sh @@ -934,32 +934,32 @@ function pv-test { echo -e " * Testing with 'pv2' complete! * \n" fi - # TBD - Do multiplication with `wc` rather than a loop here. - count=0 + typeset -i guess + guess=$(( \ + `wc -w <<< $vcodecs` * `wc -w <<< $vpresets` * `wc -w <<< $crfs` \ + * `wc -w <<< $vbrs` * `wc -w <<< $overs` * `wc -w <<< $unders` \ + * `wc -w <<< $acodecs` * `wc -w <<< $abrs` \ + * `wc -w <<< $achannels` * `wc -w <<< $afreqs` \ + )) + if (( $guess > 0 )); then + plural="" + if (( $guess != 1 )); then + plural="s" + fi + echo -e "Expecting ${guess} loop${plural}, please be patient.\n" + else + echo "ERROR: Something went wrong, got 0 loops, exiting." + return 1 + fi + + typeset -i count + unset vcodec vpreset crf vbr acodec abr ext for vcodec in $vcodecs; do for vpreset in $vpresets; do for crf in $crfs; do - for vbr in $vbrs; do for over in $overs; do for under in $under; do + for vbr in $vbrs; do for over in $overs; do for under in $unders; do for acodec in $acodecs; do for abr in $abrs; do for achannel in $achannels; do for afreq in $afreqs; do for ext in $exts; do (( count++ )) - done - done done - done done - done done done - done done done - plural="" - if (( $count != 1 )); then - plural="s" - fi - echo -e "Expecting ${count} loop${plural}, please be patient.\n" - - count=0 - unset vcodec vpreset crf vbr acodec abr ext - for vcodec in $vcodecs; do for vpreset in $vpresets; do for crf in $crfs; do - for vbr in $vbrs; do for over in $overs; do for under in $under; do - for acodec in $acodecs; do for abr in $abrs; - do for achannel in $achannels; do for afreq in $afreqs; do - for ext in $exts; do preset="" if [[ "$vpreset" != "default" ]]; then @@ -1048,7 +1048,7 @@ function pv-test { fi newfile="_${size_in}p_${vcodec}-${vpreset}-${crf}-${vbr}${ofn}${ufn}_${acodec}-${abr}-${achannel}-${afreq}.${ext}" - echo -e " * Parameters for this test: $newfile * \n" + echo -e " * [Loop $count/$guess] Parameters for this test: $newfile * \n" if [[ -e "$newfile" ]]; then mv -v "$newfile" ~/TRASH/ @@ -1092,7 +1092,6 @@ function pv-test { fi echo -e "\n * Finished in ${minutes}m${seconds}s! * \n" - (( count++ )) done done done done done