Permalink
Browse files

init

  • Loading branch information...
Zach Tatlock
Zach Tatlock committed Mar 11, 2012
0 parents commit 46ac6e825dcdc08de26651adb765f37fcf02585e
Showing with 59 additions and 0 deletions.
  1. +26 −0 README
  2. +3 −0 crontab
  3. +30 −0 xpost.sh
26 README
@@ -0,0 +1,26 @@
+Script to watch a blogger and cross post to tumblr.
+
+This is a hack with several weaknesses, including:
+ (1) posts will be lost if made at higher frequency than sampling
+ (2) updated blogger posts will be double posted to tumblr
+
+Depends on curl.
+
+crontab shows example of sampling every 10 minutes.
+
+To install, set variables at top of xpost.sh:
+
+ ROOT="/PATH/TO/THIS/DIR"
+ USER="EMAIL"
+ PASS="PASSWORD"
+ GRUP="http://FOO.tumblr.com/"
+ BLOG="http://FOO.blogspot.com"
+
+and update path in crontab:
+
+ */10 * * * * /path/to/this/dir/xpost.sh
+
+then install the crontab:
+
+ $ crontab crontab
+
@@ -0,0 +1,3 @@
+PATH = '/usr/local/bin:/usr/bin:/bin'
+
+*/10 * * * * /path/to/this/dir/xpost.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+ROOT="/PATH/TO/THIS/DIR"
+USER="EMAIL"
+PASS="PASSWORD"
+GRUP="http://FOO.tumblr.com/"
+BLOG="http://FOO.blogspot.com"
+
+#####
+
+FORM="http://terrymhung.com/jtran/tumblr/import-blogger-to-tumblr.php"
+FEED="$BLOG/feeds/posts/default?max-results=1"
+
+cd $ROOT
+touch OLD
+curl -s $FEED > NEW
+date >> log
+
+if ! diff OLD NEW > /dev/null; then
+ echo "* UPDATE!" >> log
+ cp NEW "$(date +%y%m%d-%H%M).rss"
+ curl -s \
+ --data-urlencode "email=$USER" \
+ --data-urlencode "password=$PASS" \
+ --data-urlencode "group=$GRUP" \
+ --data-urlencode "feed=$FEED" \
+ $FORM > /dev/null
+fi
+
+mv NEW OLD

0 comments on commit 46ac6e8

Please sign in to comment.