aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-10-16 15:04:51 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-10-16 15:04:51 -0300
commit58228b69d454c835e90a4eb3219ac6a6653d0836 (patch)
treef43b54638365cec9604bf6eb610048831dc2c7ec
parent73460c13773e040d75aa26b9ee6cd48c94649b79 (diff)
downloadhttruta-58228b69d454c835e90a4eb3219ac6a6653d0836.tar.gz
httruta-58228b69d454c835e90a4eb3219ac6a6653d0836.tar.bz2
Initial code for webkit2png and wkhtmltopdf
-rw-r--r--.gitmodules3
-rw-r--r--README.mdwn6
-rw-r--r--TODO.mdwn5
-rw-r--r--config.default2
-rwxr-xr-xhttracker1
-rw-r--r--lib/httracker/functions10
-rwxr-xr-xscuttler4
m---------webkit2png0
8 files changed, 29 insertions, 2 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..c68f047
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "webkit2png"]
+ path = webkit2png
+ url = https://github.com/adamn/python-webkit2png
diff --git a/README.mdwn b/README.mdwn
index 6d9bbbf..dcee8e5 100644
--- a/README.mdwn
+++ b/README.mdwn
@@ -10,3 +10,9 @@ Usage
Place this script somewhere and setup a cronjob like this:
`*/5 * * * * /var/sites/cache/httruta/httracker &> /dev/null`
+
+Features
+--------
+
+- Integration with http://wkhtmltopdf.org
+- Integration with [webkit2png](http://www.paulhammond.org/webkit2png/).
diff --git a/TODO.mdwn b/TODO.mdwn
index 259a6f9..847759e 100644
--- a/TODO.mdwn
+++ b/TODO.mdwn
@@ -4,5 +4,6 @@ TODO
- OPML support to retrieve URLs from multiple feeds.
- Support for other fetchers like youtube-dl and quvi.
- Cleanup content no longer pointed in scuttle database.
-- Integration with http://wkhtmltopdf.org
-- Integration with [webkit2png](http://www.paulhammond.org/webkit2png/).
+- Scuttler:
+ - Support to generate only an index of all URLs.
+ - Support to retrieve posts using the API.
diff --git a/config.default b/config.default
index 7b9543a..6b7f44b 100644
--- a/config.default
+++ b/config.default
@@ -10,3 +10,5 @@ GROUP="cache"
DEPTH="1"
EXT_DEPTH="0"
SCUTTLE_BASE="/var/sites/links"
+WEBKIT2PNG="1"
+WKHTMLTOPDF="1"
diff --git a/httracker b/httracker
index f899f06..bf97a6c 100755
--- a/httracker
+++ b/httracker
@@ -7,6 +7,7 @@
source `dirname $0`/lib/httracker/functions || exit 1
# Parameters
+DIRNAME="`dirname $0`"
BASENAME="`basename $0`"
FILE="$1"
diff --git a/lib/httracker/functions b/lib/httracker/functions
index d847769..ce3dd29 100644
--- a/lib/httracker/functions
+++ b/lib/httracker/functions
@@ -66,6 +66,16 @@ function httracker_get {
rm -rf $TARGET
fi
+ # Get a screenshot
+ if [ "$WEBKIT2PNG" == "1" ]; then
+ $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url"
+ fi
+
+ # Build a PDF
+ if [ "$WKHTMLTOPDF" == "1" ] && which wkhtmltopdf &> /dev/null; then
+ wkhtmltopdf "$url" $TARGET/screenshot.pdf
+ fi
+
# Fix permissions again
if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then
echo "Fixing $TARGET permissions..."
diff --git a/scuttler b/scuttler
index e4f7419..3275712 100755
--- a/scuttler
+++ b/scuttler
@@ -6,6 +6,10 @@
# 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"
diff --git a/webkit2png b/webkit2png
new file mode 160000
+Subproject 4a82a81cb0fd95faac721792951bd15ea82a11b