aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-08-25 19:58:06 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-08-25 19:58:06 -0300
commit63ee798f1f6c6a58165f328027cc3f427535c447 (patch)
tree6df949e694d559ccbff2179acbca29bdf033f83e
parent084887f69ef9229da3c8e2d09c34839ca8180aef (diff)
downloadhttruta-63ee798f1f6c6a58165f328027cc3f427535c447.tar.gz
httruta-63ee798f1f6c6a58165f328027cc3f427535c447.tar.bz2
Moving functions to lib
-rwxr-xr-xhttracker9
-rw-r--r--lib/httracker/functions13
-rwxr-xr-xscuttler23
3 files changed, 18 insertions, 27 deletions
diff --git a/httracker b/httracker
index c59004a..5b5de29 100755
--- a/httracker
+++ b/httracker
@@ -5,15 +5,6 @@
# Configuration
source config || exit 1
-MIRRORS="/var/cache/sites/arquivo/conteudo/links.sarava.org/assets"
-FEED="https://links.sarava.org/rss?sort=date_desc&count=100"
-TMP="/tmp/httracker"
-URLS="$TMP/urls.txt"
-LEVEL="1"
-EXT_LEVEL="1"
-FILESIZE=""
-USER="arquivo"
-GROUP="arquivo"
# Load functions
source lib/httracker/functions || exit 1
diff --git a/lib/httracker/functions b/lib/httracker/functions
index 0d3293a..ea9a7fa 100644
--- a/lib/httracker/functions
+++ b/lib/httracker/functions
@@ -61,3 +61,16 @@ function httracker_target_single {
target=${MIRRORDIR}/${year}/${month}
sudo -u links mkdir -p ${target}
}
+
+function httracker_scuttle_config() {
+ grep ${1} ${CONFIGFILE} | sed -e s/\[^\'\]\*\'// -e s/\'\.\*\$//
+}
+
+httracker_sqlquery() {
+ mysql --skip-column-names --batch \
+ --user=${dbuser} \
+ --password=${dbpass} \
+ --database=${dbname} \
+ --host=${dbhost} \
+ --execute="${1}"
+}
diff --git a/scuttler b/scuttler
index 6d67e5f..d846d87 100755
--- a/scuttler
+++ b/scuttler
@@ -14,29 +14,16 @@ CONFIGFILE=${BASEDIR}/${SCUTTLEDIR}/data/config.php
# Load functions
source lib/httracker/functions || exit 1
-getconf() {
- grep ${1} ${CONFIGFILE} | sed -e s/\[^\'\]\*\'// -e s/\'\.\*\$//
-}
-
-dbuser=`getconf dbuser`
-dbpass=`getconf dbpass`
-dbname=`getconf dbname`
-dbhost=`getconf dbhost`
-
-sqlquery() {
- mysql --skip-column-names --batch \
- --user=${dbuser} \
- --password=${dbpass} \
- --database=${dbname} \
- --host=${dbhost} \
- --execute="${1}"
-}
+dbuser=`httracker_scuttle_config dbuser`
+dbpass=`httracker_scuttle_config dbpass`
+dbname=`httracker_scuttle_config dbname`
+dbhost=`httracker_scuttle_config dbhost`
# Grab URLs from db
URLS=`mktemp -p ${TMP}`
chown links.links ${URLS}
chmod 600 ${URLS}
-sqlquery "select bAddress from sc_bookmarks;" > ${URLS}
+httracker_sqlquery "select bAddress from sc_bookmarks;" > ${URLS}
# Prepare and download
httracker_target_single