LOCALDB=$fspotdb
dbprefix=${dbprefix//\//\\\/}
+limit=`$NICE sqlite3 $LOCALDB "select count(*) from photos"`
+
+
+function usage()
+{
+ echo "Usage: $0 [OPTIONS]"
+ echo " Options:"
+ echo " -r remove metadata from pictures"
+ echo " -l NUMBER only process NUMBER pictures"
+}
# parse command line
-while getopts ":r" opt; do
+while getopts ":rl:h" opt; do
case $opt in
r)
removemeta=1
;;
+ l)
+ limit=$OPTARG
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
\?)
echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ :)
+ echo "Option -$OPTARG requires an argument." >&2
+ exit 1
;;
esac
done
offset=0
FILES=""
-while [ $done -lt 100 ] ; do
- echo "skipping $offset pics, getting 50 new pics to work on..."
+while [ $done -lt $limit ] ; do
+ echo "skipping $offset pics, getting $limit new pics to work on..."
# handle white space in filename correctly
- FILES=`$NICE sqlite3 $LOCALDB "select replace(base_uri||'/'||filename,' ','%20') from photos limit $offset,100"`
+ FILES=`$NICE sqlite3 $LOCALDB "select replace(base_uri||'/'||filename,' ','%20') from photos limit $offset,$limit"`
if [ "x$FILES" != "x" ] ; then
#found some files, process them
break;
fi
- #get ready to get the next 100
- offset=$((offset+50))
+ #get ready to get the next photos
+ offset=$((offset+$limit))
done