Freed from Radio!

All of my old posts have now been extracted from Radio. Upstreaming to the filesystem didn’t work. Backup didn’t work. Fortunately, Radio implments the Blogger XML-RPC API and, equally as fortunate, Python offers a trivial interface for calling out to XML-RPC servers.

This was the first post I ever kept in Radio. It was posted on 19-January-2002, within days of exactly two years ago. The first few posts I made were deleted accidentally. Nothing really lost.


Maybe I’ll actually start posting to this thing. Maybe not. Radio is really a pretty crappy application. I mean, I appreciate the power and everything that has been achieved– but the look and feel SUCKS.

This whole half-desktop-app-half-browser-app-lets-duplicate-functionality-between-but-make-it-different approach to an app is really broken.

Yet, at the same time, it does make publishing notes and sharing ideas really bloody easy (as long as you don’t even remotely attempt to look under the hood– then it doesn’t make sense). To those ends, Radio is a hell of an achievement and the community surrounding it is confirmation.

I would really like to roll my own solution, but time is not something that I have a surplus of.

If I could only figure out how to publish via WebDAV, life would be good… I am not a number, I have a domain all my own.

Radio was an education, certainly, and worth every penny of the $40 or so that I put into it. Thanks UserLand! I sincerely hope that Radio 9.0 ships someday and, when it does, that it follows some kind of useful modern API and HI guidelines.

The script to export from Radio is as follows:

#! /usr/bin/python
import sys

password = sys.argv[1]

import xmlrpclib
import xml
server = xmlrpclib.Server('http://localhost:5335/RPC2')
lastPost = server.blogger.getRecentPosts('export','home','default',password,1)

if not lastPost:
    print "failed to get last post"
    sys.exit(1)

postCount = int(lastPost[0]['postid'])
print "Exporting %d posts..." % postCount

for i in xrange(0, postCount + 1):
    try:
        post = server.blogger.getPost('export',i,'default',password)
        content = post['content']
        dateCreated = post['dateCreated']
        out = file('post-%03d.txt' % i, 'w')
        out.write(post['content'])
        out.write('\n\n%s\n' % dateCreated)
        out.flush()
        out.close()
        print "Wrote post %d...." % i
    except xml.parsers.expat.ExpatError:
        print "Skipping post %d...." % i
    

It expects your password as the first argument on the command line. You could easily hardwire it by replacing the sys.argv[1] with your password in ‘quotes’ on the 4th line.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.