#!/bin/csh -f

# Concurrently extracts video in the capture buffers in a directory

#check command line
if ( $#argv != 2 ) then 
  echo "Usage: rextractall <capture_number> <path>";
  exit 1 
endif

#get the command line
set PATHIN=$argv[2]; #path
set CAPTURE=$argv[1]; #capture number

# grab
set NUM_VIEWS=`cameras.csh`;
set i=0;
while ($i<$NUM_VIEWS)
  set GRABBER=`cameras.csh $i`;
  set MACHINE=$GRABBER[1];
  set VIDEOGRAB=$GRABBER[3];
  set SRCFILE=${PATHIN}/grab.${i}.${CAPTURE}
  set DESTFILE=${PATHIN}/grab.${i}.00000.png
  rsh $MACHINE $VIDEOGRAB -i $SRCFILE -o $DESTFILE &
  set i=`expr $i + 1`;
end

