aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-08-25 20:01:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-08-25 20:01:03 -0300
commit32d0733a7ad32017649f0c0a5ac2b82e85af38db (patch)
tree723d1ec998c1f3f70de44d3d1c9c9feb7a826bf0
parent63ee798f1f6c6a58165f328027cc3f427535c447 (diff)
downloadhttruta-32d0733a7ad32017649f0c0a5ac2b82e85af38db.tar.gz
httruta-32d0733a7ad32017649f0c0a5ac2b82e85af38db.tar.bz2
Adding httracker_iterate
-rwxr-xr-xhttracker4
-rw-r--r--lib/httracker/functions28
-rwxr-xr-xscuttler8
3 files changed, 22 insertions, 18 deletions
diff --git a/httracker b/httracker
index 5b5de29..385035c 100755
--- a/httracker
+++ b/httracker
@@ -22,9 +22,7 @@ if [ "$?" != "0" ]; then
fi
# Iterate over all URLs
-for link in `cat $URLS | xargs`; do
- httracker_get "$link"
-done
+httracker_iterate
# Cleanup
rm -rf $TMP
diff --git a/lib/httracker/functions b/lib/httracker/functions
index ea9a7fa..c7dff7f 100644
--- a/lib/httracker/functions
+++ b/lib/httracker/functions
@@ -41,27 +41,25 @@ function httracker_get {
fi
}
-function httracker_get_single {
-# grabs URLs from the network
+function httracker_get_incremental {
+ # Creates target dir
+ year=`date +%Y`
+ month=`date +%m`
+ %day=`date +%d`
+ target=${MIRRORDIR}/${year}/${month}
+ sudo -u links mkdir -p ${target}
+
+ # Grabs URLs from the network
httrack --verbose \
--user links \
--depth=1 \
--purge-old=0 \
--index \
--cookies=1 \
- --list ${tmpfile} \
+ --list ${URLS} \
--path ${target} \
}
-function httracker_target_single {
- # creates target dir
- year=`date +%Y`
- month=`date +%m`
- %day=`date +%d`
- target=${MIRRORDIR}/${year}/${month}
- sudo -u links mkdir -p ${target}
-}
-
function httracker_scuttle_config() {
grep ${1} ${CONFIGFILE} | sed -e s/\[^\'\]\*\'// -e s/\'\.\*\$//
}
@@ -74,3 +72,9 @@ httracker_sqlquery() {
--host=${dbhost} \
--execute="${1}"
}
+
+function httracker_iterate {
+ for link in `cat $URLS | xargs`; do
+ httracker_get "$link"
+ done
+}
diff --git a/scuttler b/scuttler
index d846d87..0b2b6da 100755
--- a/scuttler
+++ b/scuttler
@@ -25,9 +25,11 @@ chown links.links ${URLS}
chmod 600 ${URLS}
httracker_sqlquery "select bAddress from sc_bookmarks;" > ${URLS}
-# Prepare and download
-httracker_target_single
-httracker_get_single
+# Download in incremental mode
+httracker_get_incremental
+
+# Download in mirror mode
+httracker_iterate
# Cleanup
rm -rf $TMP