<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scott Yang's Playground &#187; mtsend</title>
	<atom:link href="http://scott.yang.id.au/tag/mtsend/feed/" rel="self" type="application/rss+xml" />
	<link>http://scott.yang.id.au</link>
	<description>Faith, Technology and Randomness in Life, According to Scott</description>
	<lastBuildDate>Thu, 09 Feb 2012 09:01:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Update: mtsend.py 1.0 Has Been Released</title>
		<link>http://scott.yang.id.au/2005/05/update-mtsendpy-10-has-been-released/</link>
		<comments>http://scott.yang.id.au/2005/05/update-mtsendpy-10-has-been-released/#comments</comments>
		<pubDate>Thu, 26 May 2005 03:27:33 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mtsend]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2005/05/update-mtsendpy-10-has-been-released/</guid>
		<description><![CDATA[I have not updated mtsend.py for more than a year, as it has been working quite comfortably for me. I have made some slight modifications during this year just to scratch some of my itches. Also thanks to Ilkka Poutanen for providing bug fixes on the printTable() routine. Thus I am declaring mtsend.py an 1.0 [...]]]></description>
			<content:encoded><![CDATA[<p>I have not updated <a href="http://scott.yang.id.au/2002/12/mtsendpy/">mtsend.py</a> for more than a year, as it has been working quite comfortably for me. I have made some slight modifications during this year just to scratch some of my itches. Also thanks to <a href="http://ipo.iki.fi/">Ilkka Poutanen</a> for providing bug fixes on the <code>printTable()</code> routine. Thus I am declaring <code>mtsend.py</code> an <b>1.0</b> status!</p>
<blockquote><p>
  Download <a href="http://scott.yang.id.au/file/python/mtsend-1.0.zip">mtsend-1.0.py</a>
</p>
</blockquote>
<p>Changes:</p>
<ul>
<li><code>time</code> module related fix for Python 2.4.</li>
<li>Ensure all cells passed to printTable() function are in string-type.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2005/05/update-mtsendpy-10-has-been-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Update: mtsend.py 0.6 Has Been Released.</title>
		<link>http://scott.yang.id.au/2004/04/update-mtsendpy-06-has-been-released/</link>
		<comments>http://scott.yang.id.au/2004/04/update-mtsendpy-06-has-been-released/#comments</comments>
		<pubDate>Thu, 01 Apr 2004 13:47:07 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mtsend]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2004/04/update-mtsendpy-06-has-been-released/</guid>
		<description><![CDATA[I have no idea why no one has requested, but I have added the feature in release 0.6 of mtsend.py anyway &#8211; HTTP proxy server support. I am now sitting on a host behind a squid server, so proxy server support becomes essential to me. With 0.6, mtsend.py should automatically pick up your proxy server [...]]]></description>
			<content:encoded><![CDATA[<p>I have no idea why no one has requested, but I have added the feature in release 0.6 of <a href="http://scott.yang.id.au/archives/000092.php">mtsend.py</a> anyway &#8211; HTTP proxy server support. I am now sitting on a host behind a squid server, so proxy server support becomes essential to me. With 0.6, mtsend.py should automatically pick up your proxy server setting from your <code>HTTP_PROXY</code> environment variable.</p>
<blockquote><p>
  Download <a href="http://scott.yang.id.au/file/python/mtsend-0.6.zip">mtsend-0.6.py</a>
</p>
</blockquote>
<p>Hopefully it would be the last release before MovableType 3 comes out.</p>
<p><b>Updated 6 April</b>: Thanks for the <a href="http://scott.yang.id.au/archives/000092.php#comment000981">correction from Brad</a>, I have updated the script to properly handle <code>mt_allow_comments</code>. It would be <b>0.6.1</b> with some minor clean ups.</p>
<blockquote><p>
  Download <a href="http://scott.yang.id.au/file/python/mtsend-0.6.1.zip">mtsend-0.6.1.py</a>
</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2004/04/update-mtsendpy-06-has-been-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update: mtsend.py 0.5 Has Been Released.</title>
		<link>http://scott.yang.id.au/2003/10/update-mtsendpy-05-has-been-released/</link>
		<comments>http://scott.yang.id.au/2003/10/update-mtsendpy-05-has-been-released/#comments</comments>
		<pubDate>Tue, 14 Oct 2003 07:02:23 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mtsend]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2003/10/update-mtsendpy-05-has-been-released/</guid>
		<description><![CDATA[After 6+ months of inactive, I&#8217;ve finally made some changes to my mtsend.py script that allows someone to post/edit blog entries on MovableType in the luxury of Un*x/DOS command line. In version 0.5, I have removed all the supports for MovableType 2.5 to keep the code clean, so please use version 0.4 if you are [...]]]></description>
			<content:encoded><![CDATA[<p>After 6+ months of inactive, I&#8217;ve finally made some changes to my <a href="http://scott.yang.id.au/archives/000092.php">mtsend.py</a> script that allows someone to post/edit blog entries on <a href="http://www.movabletype.org/">MovableType</a> in the <em>luxury</em> of Un*x/DOS command line. In version 0.5, I have removed all the supports for MovableType 2.5 to keep the code clean, so please use <a href="http://scott.yang.id.au/archives/000132.php">version 0.4</a> if you are still using the older releases of MovableType.</p>
<p>Here&#8217;s a list of changes:</p>
<ul>
<li>Remove the support of MovableType 2.5 to trim the code.</li>
<li>Support <tt>KEYWORDS</tt> and <tt>PING</tt> in the header. Use <tt>KEYWORDS</tt> to set the keyword of your post entry. Use one or more <tt>PING</tt> in the header to ping URLs.</li>
<li>Add some new functionalities provided by the MovableType 2.6&#8242;s XML-RPC backend.
<ul>
<li>Use <tt>-P postid</tt> to list all the trackback pings of this post entry.</li>
<li>Use <tt>-T</tt> to list all the text filters installed in MovableType.</li>
</ul>
</li>
<li><tt>CONVERT BREAKS</tt> header now supports text filters.</li>
</ul>
<p>And some tiny changes here and there as well I think.</p>
<blockquote><p>
  Download <a href="http://scott.yang.id.au/file/python/mtsend-0.5.zip">mtsend-0.5.py</a>
</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2003/10/update-mtsendpy-05-has-been-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Update: mtsend.py 0.4 Has Been Released.</title>
		<link>http://scott.yang.id.au/2003/03/update-mtsendpy-04-has-been-released/</link>
		<comments>http://scott.yang.id.au/2003/03/update-mtsendpy-04-has-been-released/#comments</comments>
		<pubDate>Sun, 09 Mar 2003 14:38:38 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mtsend]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2003/03/update-mtsendpy-04-has-been-released/</guid>
		<description><![CDATA[I&#8217;ve finally upgraded myself to MovableType 2.6.3 this morning, and not surprisingly, my command-line MT client script mtsend.py does not work properly anymore. D&#8217;oh. It is mainly due to some changes in the XML-RPC API, i.e. boolean is now integer for a particular field, etc. Fixing up is trivial, but at the same time I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally upgraded myself to <a href="http://www.movabletype.org/">MovableType</a> 2.6.3 this morning, and not surprisingly, my <a href="http://scott.yang.id.au/archives/000092.php">command-line MT client script mtsend.py</a> does not work properly anymore. D&#8217;oh. It is mainly due to some changes in the XML-RPC API, i.e. boolean is now integer for a particular field, etc. Fixing up is trivial, but at the same time I also like to retain backward compatibility with MT2.5. So a few new code has been added to toggle functionalities depending on the MovableType version.</p>
<p>To specify MovableType version for your site, add the following options to your <tt>.mtsendrc</tt>:</p>
<pre class="code">
  [site-example]
  url=http://example.com/cgi-bin/mt-xmlrpc.cgi
  username=foo
  password=bar
  <b>mtversion=2.6</b>
</pre>
<p>The default MovableType version is 2.5, and it is necessary to add that option into <tt>.mtsendrc</tt> to have it working with 2.6.x. I think it possible to automatically detect server-side versions, but it might require an extra HTTP POST per operation. Maybe I will try that next.</p>
<p>An additional function has been added to the XML-RPC API. You can now <em>upload</em> files onto your MT site using <tt>metaWeblog.newMediaObject()</tt> call. I&#8217;ve included that into <tt>mtsend.py</tt> as well, and you can now do the following to upload a binary/text file.</p>
<pre class="code">
  $ mtsend.py -U <i>filename</i> &lt; file
</pre>
<p>It will upload the content of <tt>file</tt> to the MT site, and save it as <tt>filename</tt>. The full URL will be printed at the end for the newly uploaded file.</p>
<p><b>Update 14 Oct 2003</b>: Version 0.4 will be the last that supports MovableType 2.5, as the new 0.5 will be MovableType 2.6 <em>only</em>. You can still download the older version here:</p>
<blockquote><p>
  <a href="http://scott.yang.id.au/file/python/mtsend-0.4.zip">mtsend-0.4.py</a>
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2003/03/update-mtsendpy-04-has-been-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mtsend.py &#8211; A Command Line Tool for Movable Type</title>
		<link>http://scott.yang.id.au/2002/12/mtsendpy/</link>
		<comments>http://scott.yang.id.au/2002/12/mtsendpy/#comments</comments>
		<pubDate>Mon, 30 Dec 2002 01:53:00 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Movable Type]]></category>
		<category><![CDATA[mtsend]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2002/12/mtsendpy/</guid>
		<description><![CDATA[I&#8217;ve spent a bit of time coding and testing during the Christmas break, and here it is &#8211; mtsend.py, a command line tool for Movable Type (SY: Works fine in WordPress as well) written in Python. It uses XML-RPC exported by Movable Type to retrieve posts, edit posts, make new post entry, fix up categories [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent a bit of time coding and testing during the Christmas break, and here it is &#8211; <tt>mtsend.py</tt>, a command line tool for <a href="http://www.movabletype.org/">Movable Type</a> (<b>SY</b>: Works fine in <a href="http://wordpress.com/">WordPress</a> as well) written in <a href="http://www.python.org/">Python</a>. It uses XML-RPC exported by Movable Type to retrieve posts, edit posts, make new post entry, fix up categories and list recent posts, etc. It is a command line tool, i.e. no graphical user interface, but it is relatively easy to use. It is written in a scripting language called Python, and it currently has only been tested under Python 2.1 on Windows 2000, and Python <del>2.2/</del>2.3/2.4 on Linux (<del>Mandrake 8.2/9</del><ins>Gentoo</ins>), Windows 2000<ins>/XP</ins> and <ins>Mac OS X 10.2/10.3</ins>.</p>
<p>You can download the source code here:</p>
<ul>
<li>Download <a href="http://scott.yang.id.au/file/python/mtsend.zip">mtsend.py</a> 1.1 (<em>Released on 19 Nov 2005</em>)
</ul>
</p>
<h3 id="toc-what-is-it">What is it?</h3>
<p><tt>mtsend.py</tt> is a command line tool that utilise Movable Type&#8217;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&#8217;s <a href="http://www.movabletype.org/docs/mtimport.html">import export format</a>.</p>
<p><b>Updated</b>: It appears that <code>mtsend.py</code> also works with <a href="http://wordpress.org/">WordPress</a>, 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.</p>
<p><b>Updated 2</b>: There seems to be some timezone issue regarding how WP handles <code>dateCreated</code> attribute, tested in WP 1.5.</p>
<h3 id="toc-why-command-line">Why command line?</h3>
<p><em>Real man</em> works on text-consoles.</p>
<p>No. It is not true. But 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 <a href="http://w3m.sourceforge.net/">w3m</a>. I don&#8217;t like to fire up Mozilla and open up the Movable Type site just to post an blog entry. Moreover, I have very <em>bad</em> 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&#8217;s edit entry page. However, since Movable Type has already exported its interface via XML-RPC, why don&#8217;t I just write a simple script to post that text file after I&#8217;ve run it through the spell checker? The result becomes <tt>mtsend.py</tt>.</p>
<p>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 <tt>aspell check</tt>, and then direct it to <tt>mtsend.py</tt> to have it posted to my blog site. All under your favourite Unix shell!</p>
<h3 id="toc-documentation">Documentation</h3>
<p>These are taken directly from the source code &#8211; so just download the latest source and you will have the lot.</p>
<h4 id="toc-configuration-file">Configuration File</h4>
<pre class="code" style="font-size:85%">
  Configuration file for mtsend.py is in the style of Windows INI files, which
  consist of sections and key/value pairs. There are 3 main sections - global,
  site and blog.

  Global Section:
    There is only one key/value in this section, and it is used to note the
    default blog alias to use if it is not provided on the command line.
    For example:

      [global]
      default=example

    It shows the default blog alias will be 'example'

  Site Section:
    You can have multiple site sections for each Movable Type installation
    you have access to. The section name will be [site-"site name"]. For
    example:

      [site-test]
      url=http://testdomain.com/mtinstall/mt-xmlrpc.cgi
      username=foo
      password=bar
      encoding=UTF-8

    It defines site "test" with the URL to the MovableType's XML-RPC CGI
    script, and the username/password used to access that site. "encoding" is
    optional, and defaults to UTF-8.

  Blog Section:
    You can have multiple blog sections for each Movable Type blogs you have
    on the sites you have access to. Blogs are distinguished by their 'alias',
    which you can select in the command line using -a. The section name for
    this blog will be [blog-"blog alias"]. For example,

      [blog-example]
      site=test
      blogid=3

    Each blog section must have "site", which indicates the site this blog
    belongs to, so that mtsend would be able to locate site-related
    information from the configuration file. It also needs the blog ID on that
    site. To find out all the blog IDs, you can use -B "site name" to print
    out the list.
</pre>
<h4 id="toc-post-format">Post Format</h4>
<pre class="code" style="font-size:85%">
  When editing or posting via mtsend, the post needs to be in a specific
  format. The format is very close to Movable Type's import/export format,
  which is documented here:

http://www.movabletype.org/docs/mtmanual_importing.html

  It consists of a header and body. For example:

    [header1]: [value1]
    [header2]: [value2]
    [header3]: [value3]
    -----
    BODY:
    ....
    -----
    EXTENDED BODY:
    ....
    -----
    EXCERPT:
    ....

  Extended body and excerpt are optional in a post. Most header elements are
  optional when you are creating a new post. If they do not provide a value,
  then the default value configured by Movable Type will be used.

  These are the header keys/values:

    TITLE:
      The title of this post.

    ALLOW COMMENTS: 0/1
      Whether this post allows comments.

    ALLOW PINGS: 0/1
      Whether this post allows trackback pings.

    CATEGORY:
      The category associated with this post entry. You can have multiple
      CATEGORY in the header. The first CATEGORY automatically becomes the
      primary category, if PRIMARY CATEGORY is not specified.

    CONVERT BREAKS: 0/1/customised text filter name.
      Whether the line break will be automatically converted into &lt;br/&gt; and
      &lt;p/&gt; when posted. It can also be the name of an installed text filer. To
      get the list of installed text filter, use mtsend.py -T

    DATE: dd/mm/yyyy HH:MM:SS [AM|PM]
      The post date. It might not work if you are creating a new post.

    KEYWORDS:
      The keywords of your post.

    PING:
      The URL to be pinged during posting. You can have multiple PING in the
      header.
</pre>
<h4 id="toc-command-line-argument">Command Line Argument</h4>
<pre class="code" style="font-size:85%">
  Usage:
      mtsend.py [action] [options]

  Actions:
      -B site     List all the blogs you can access in [site]. Site has to be in
                  the configuration file.
      -C          Print out a list of existing categories.
      -E postid   Edit an old post. It will read the post entry from the
                  standard input, in Movable Type's import/export format, and
                  then save it back to the server. If the value is '-', then it
                  will try to detect the postid from the input message itself.
      -G postid   Retrieve/get post from the blog. If the value is '-', it will
                  then try to get the most recent blog entry. Retrieved entry
                  will be printed to the standard output.
      -L num      List the most recent [num] posts.
      -N          Posting a new blog. The entry, in the Movable Type
                  import/export format, is read from the standard input.
      -P postid   List out trackback pings to this post.
      -R postid   Rebuild all the static files related to this entry.
      -T          List out the text filters installed on the server.
      -U filename Upload a file, reading from standard input, to the blog site,
                  with destination filename provided.
      -V          Show version information.

  Options:
      -a alias    Use "alias" as the blog alias. This script will locate
                  relavent site URL/username/password information using this
                  alias.
      -c config   Load "config" as configuration file, instead of $HOME/.mtsendrc
      -h          Display this help message.
      -q          Decrease verbose level.
      -v          Increase verbose level. Message goes to standard error.
</pre>
<h3 id="toc-history">History</h3>
<ul>
<li><b>1.1</b></a> &#8211; 19 Nov 2005
<ul>
<li>Add SSL support over proxy.</li>
</ul>
</li>
<li><a href="http://scott.yang.id.au/update-mtsendpy-10-has-been-released/"><b>1.0</b></a> &#8211; 26 May 2005
<ul>
<li><code>time</code> module related fix for Python 2.4.</li>
<li>Ensure all cells passed to printTable() function are in string-type.</li>
</ul>
</li>
<li><b>0.6.1</b></a> &#8211; 6 Apr 2004
<ul>
<li>Properly handles mt_allow_comments for MT2.6 servers.</li>
</ul>
</li>
<li><a href="http://scott.yang.id.au/2004/04/update-mtsendpy-06-has-been-released/"><b>0.6</b></a> &#8211; 1 Apr 2004
<ul>
<li>Add build-in support for HTTP proxy server, which is detected via environment variable HTTP_PROXY.</li>
<li>Alternative encoding for XML-RPC packets.</li>
</ul>
</li>
<li><a href="http://scott.yang.id.au/2003/10/update-mtsendpy-05-has-been-released/"><b>0.5</b></a> &#8211; 14 Oct 2003
<ul>
<li>Remove the support of MT2.5. Use the <a href="http://scott.yang.id.au/archives/000132.php">older version</a> of mtsend.py if you need these supports.</li>
<li>Support KEYWORDS and PING into the header.</li>
<li>Add new functionalities provided by MT2.6&#8242;s backend.
<ul>
<li>List out trackback pings of a post.</li>
<li>List out text filters installed.</li>
</ul>
</li>
<li>Documentation in the source code.</li>
</ul>
</li>
<li><a href="http://scott.yang.id.au/2003/03/update-mtsendpy-04-has-been-released/"><b>0.4</b></a> &#8211; 10 Mar 2003
<ul>
<li>Support the new <tt>metaWeblog.newMediaObject()</tt> function via <tt>mtsend.py -U <em>filename</em></tt>, i.e. you can now upload text/binary files to your MovableType site via <tt>mtsend.py</tt>!</li>
<li>Use <tt>mt.getRecentPostTitles()</tt> function in MT2.6 to save bandwidth.</li>
<li>Some bug fixes due to some inconsistency between MT2.6 and MT2.5.</li>
</ul>
</li>
<li><b>0.3</b> &#8211; 3 Jan 2003
<ul>
<li>Make it to work on Python 2.1. &#8220;xmlrpclib&#8221; needs to be downloaded separately. It is tested on Python 2.1.2 for Windows.</li>
</ul>
</li>
<li><b>0.2</b> &#8211; 30 Dec 2002
<ul>
<li>Fixed a bug in saving the post entry back, where new line characters are stripped.</li>
</ul>
</li>
<li><b>0.1</b> &#8211; 30 Dec 2002
<ul>
<li>Initial public version</li>
</ul>
</li>
</ul>
<h3 id="toc-external-resources">External Resources</h3>
<ul>
<li><a href="http://www.pythonware.com/products/xmlrpc/">XML-RPC for Python</a> &#8211; you need to install &#8220;xmlrpclib&#8221; if you are using Python 2.1</li>
<li><a href="http://www.movabletype.org/docs/mtmanual_programmatic.html#xmlrpc%20api">Movable Type XML-RPC API</a> &#8211; references from Movable Type&#8217;s site.</li>
<li><a href="http://diveintomark.org/projects/pyblogger/">PyBlogger</a> &#8211; Blogger API wrapped in Python (thanks to Karl)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2002/12/mtsendpy/feed/</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
	</channel>
</rss>

