]> gitweb.fluxo.info Git - httruta.git/commitdiff
Moving functions to lib
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 25 Aug 2013 22:58:06 +0000 (19:58 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 25 Aug 2013 22:58:06 +0000 (19:58 -0300)
httracker
lib/httracker/functions
scuttler

index c59004abe97aa962e9fd2abac79a623ac1284acc..5b5de29618cdfd16f0ffeb06f1fa5a4a4496cec8 100755 (executable)
--- 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
index 0d3293a0f4547522b0f326feda822743a58ee690..ea9a7fa1fc59463271e5fb8838048eb8b2c47200 100644 (file)
@@ -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}"
+}
index 6d67e5f18a892c2f9a687cdc39c8f60da086d701..d846d87b66753fe7618a49448993cf4e41c9246f 100755 (executable)
--- 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