#!/bin/bash
#
# Download all links from a Semantic Scuttle instance.
#

# Load and initialize
source `dirname $0`/lib/httracker/functions || exit 1

# Parameters
DIRNAME="`dirname $0`"
BASENAME="`basename $0`"

# Other parameters
SCUTTLEDIR="`basename $( find ${SCUTTLE_BASE} -maxdepth 1 -iname "SemanticScuttle-*" | head -n 1 )`"
CONFIGFILE="${SCUTTLE_BASE}/${SCUTTLEDIR}/data/config.php"
DBUSER="`httracker_scuttle_config dbuser`"
DBPASS="`httracker_scuttle_config dbpass`"
DBNAME="`httracker_scuttle_config dbname`"
DBHOST="`httracker_scuttle_config dbhost`"

# So we can run both applications in parallel
URLS="$URLS_SCUTTLER"

# Get URLs from database
echo "Querying database..."
httracker_sqlquery "select bAddress from sc_bookmarks;" > ${URLS}

# Download in incremental mode
#httracker_get_incremental

# Download in mirror mode
httracker_iterate

# Done
httracker_teardown