For fun, I decided to write a little Service to upload my Tumblr entries (which I compose in Markdown, using Emacs). It’s a pretty simple workflow, with most of the work being done by this shell script:
bash:
source ~/.tumblr-private
TITLE=$(head -n 1 "$1" | sed -e 's/^Title: //g')
BODY=$( tail -n +2 "$1")
curl -X POST -d email="${TUMBLR_USER}" -d password="${TUMBLR_PASSWD}" \
-d type=regular -d state=queue -d format=markdown --data-urlencode title="${TITLE}" \
--data-urlencode body="${BODY}" http://www.tumblr.com/api/write
To make this script work for you, just put create a file called .tumblr-private in your home directory and give it your Tumblr credentials, e.g.
TUMBLR_USER=user@place.com
TUMBLR_PASSWD=mypassword567
This script is pretty simple, and assumes that the first line of the file is of the form Title: <your title>.
To make this work as a Service, just create a Service workflow that takes a file as input, add a “Run Shell Script” with the above script as the body, and set “Pass input:” to “as arguments”. I also have another step, removing the colour label on the file, as I’ve started using Hazel to label unpublished entries.