A month on the command line, Day 7: Movable Type from the command line
DBR commented on my Blogging without a GUI post and told me about mtsend.py - A Command Line Tool for Movable Type.
Here's a description of what it does:
mtsend.py is a command line tool that utilise Movable Type’s XML-RPC interface. It allows its users to edit/post/view/list post entries on a Movable Type site. It takes input from the standard input, and sends output to the stdout, just like all the other well-behaved command line applications. It uses a file format similar to Movable Type’s import export format.
Updated: It appears that mtsend.py also works with WordPress, as WordPress has implemented a compatible XML-RPC interface. In fact I am using this same script everyday since I switched from MT to WP.
...
With a command line tool that can work with pipes and standard IO, it makes posting much easier for me. I can now write up a blog entry in Vi, save the text file, run it through aspell check, and then direct it to mtsend.py to have it posted to my blog site. All under your favourite Unix shell!
And on this page -- and included with the source code -- is clear information on how to write the configuration file for mtsend.py.
As you may be able to tell from the .py part of the name, the app is written in Python. There's this note: "You need to install 'xmlrpclib' if you are using Python 2.1."
And as an aside, Scott Yang, who wrote the app, uses the w3m text Web browser. I'll have to try that one.
Here's Scott's reasoning behind the development of mtsend.py:
I found myself spending most of my day in the front of text console/command prompt. My typical Windows desktop consists 2 of VIM windows and 2 SSH session to other Linux boxes, and half the website I browse everyday is in the excellent text-mode browser w3m. I don’t like to fire up Mozilla and open up the Movable Type site just to post an blog entry. Moreover, I have very bad spelling problem, and posting through the web interface does not allow me to check my spellings. Of course I can edit my post in a separate editor, run that external file through a spell checker, and then paste the content into the Movable Type’s edit entry page. However, since Movable Type has already exported its interface via XML-RPC, why don’t I just write a simple script to post that text file after I’ve run it through the spell checker? The result becomes mtsend.py.
If I can figure it out, It'll be amazing.
Comments
You can also post Movable Type entries from within Emacs with weblogger.el (and browse the web with w3m from within Emacs with emacs-w3m, handy if you want to cut and paste URLs or text to your blog entry.)
Posted by: Zed | May 9, 2007 4:35 PM