Moblogging

I decided to set up moblogging on planB (a movable type weblog), inspired bydanbri’s typepad one. There are probably better ways of doing it…Joi Ito has a moblogging resources page that might be useful.

I fooled around a bit with Joi Ito’s python script but didn’t know enough python to be bothered to debug the error I got (it was Saturday):

sh:~/moblog/mail2entry-2002-12-25$ cat 416D0264.jpg | python /home/libby/moblog/mail2entry-2002-12-25/mail2entry.py test
/home/libby/moblog/mail2entry-2002-12-25/mail2entry.py:8: SyntaxWarning: import * only allowed at module level
def main():
Traceback (most recent call last):
File "/home/libby/moblog/mail2entry-2002-12-25/mail2entry.py", line 50, in ?
main()
File "/home/libby/moblog/mail2entry-2002-12-25/mail2entry.py", line 43, in main
return result
UnboundLocalError: local variable 'result' referenced before assignment

Another guy had the same problem but no solution.

So then I tried Dav Coleman’s perl version. It requires XMLRPC::Lite and MIME::Explode; they were both on the system I was using. I commented out the japanese text bits and the system calls to java etc.

I have an account that can recieve mail on the same machine as my blog. I don’t know whether it needs to be – the perl program uses XMLPRC to post to the blog.

So, in order, this is what I did.

  • created an email alias on the machine. I could have used my default one, but figured better to make it a bit more secret. Just knowing the mail address wouldn’t allow anyone else to post though.
  • got the perl prgram, made sure XMLRPC::Lite and MIME::Explode were installed

  • edited out the ‘system’ calls and japanese bits I didn’t need
  • with help from shellac, installed procmail and wrote a .procmailrc file in my home directory:

    :0:
    * ^FROM: .*theemailaddrfrommyphone
    |/home/libby/moblog/perl/blogpost.pl
    
  • set up a new username and password for my blog and found out a bunch of information I needed
  • created .blogpostrc file in my home fdirectory, looking like this (following the instructions in the perl file)

    blogurl = http://planb.nicecupoftea.org
    blogxmlrpc = http://rdfweb.org/mtcgi/mt-xmlrpc.cgi
    blogimgurl = https://planb.nicecupoftea.org/archives/images
    subdir = default
    output_dir = /usr/local/apache/htdocs/archives/images
    bloguser = username
    blogpass = pwd
    blogid = 5
    defaulttitle = new post from cell phone
    defaultbody = 
    defaultcategory = 28
    
  • tested it by mailing myself a picture from my phone

Fiddling with the actual perl code (to process text atachments), it was easier just to pipe a saved message to procmail manually: cat msg | procmail

And bingo – it worked. I’m going to set up a new blog specicically for pictures. And then I want to be able to parse RDF somehow out of the text attachments.