Posting from the command line using mtsend

2006-07-17, Comments

mtsend is a simple Python program which lets me post to this weblog direct from a command line, so I can continue to live inside emacs.

Configuring mtsend

To get started with mtsend, download it direct from the website. Then create a configuration file, like this:

mtsend.cfg
[global]
default=wa

[site-Word Aligned]
url=http://blog.wordaligned.org/backend/xmlrpc
username=***
password=***

[blog-wa]
site=Word Aligned
blogid=1

Using mtsend

Now you can use mtsend to query, post or edit articles on your web log.

mtsend examples
mtsend.py -c mtsend.cfg -a wa -E 25 < post # edit post
mtsend.py -c mtsend.cfg -a wa -L 3         # List last three posts
mtsend.py -c mtsend.cfg -a wa -N < post    # new post
mtsend.py -c mtsend.cfg -a wa -C           # List categories

For an even simpler command line, just copy the configuration file to your home directory: cp mtsend.cfg ~/.mtsendrc. You can also omit the blog alias (supplied by the -a option) if you’re posting to your default blog.

Post format

The format for posts is very close to Movable Type’s import/export format. As an example, here’s the first few lines of this very post!

Example Post
TITLE: Posting from the command line using mtsend
PRIMARY CATEGORY: Web Applications
CATEGORY: Python
CONVERT BREAKS: Markdown
----
BODY:
[mtsend](http://scott.yang.id.au/2002/12/mtsendpy/) lets me post to
this weblog direct from a command line, so I can continue to live
inside [emacs](http://www.gnu.org/software/emacs/).
----
EXTENDED BODY:
#### Configuring mtsend

To get started with mtsend, download it direct from the website.
Then create a configuration file, like this:
....