Happy Coding
Sunday, April 17, 2005
  Finally command-line blogging!

I was thinking that blogging from commandline would bring many benefits. For example, I could use powerful vi for editing needs. And I could blog from anywhere that has a ssh connection to my workstation. That is, no requirement of graphical user interface always extends the possibility of usage and convenience. People may think I am a geek too much loving the chars black and white. No! I hate the unstability of using web interface for blogging. Users cannot be delayed! They should focus on their work, not waiting!

Unfortunately, even with google, I feel no lucky of finding any tool available that even comes close to my basic needs. Because all of them claiming using commandline does not support posting to blogger. Due to my latest preference to perl, I tried to locate any module for blogger api. Yes, it does have! Cool..Perl! However,:), the module is not mature enough to support internationalization and some of the minor issues. Furthermore, the important feature of posting with title is even missing. Expecting a full support of new atom api is frustrating.

I finally figured out a simple solution by using blogger's mail2blog service:) It's really amazing if it could be always efficient and stable enough, though. I tackled today a little bit on MIME:Lite and MIME:base64, which elegantly do the job to encapsulate a normal html text into a standard MIME mail package. In one word, I make it:)

Basically my script does the following:
1. invoke vi for editing, and no need to consider a filename 'cause i use a unique value for that. the post title anyway has to be at the first line, no restriction of editing further.
2. after saving, it encapsulates the post you edited to a standard mail package that will be delivered to the specified mail2blog address, i.e. your target blog in blogger.com.
3. actually delivery of mail is done via SMTP. you must provide one SMTP account for this. I tried to use 'sendmail' for delivery, but apparently blogger.com does not accept mails from it, though Gmail server will. I don't know why. Anybody happens to see this post and knows why, please tell me.

Summary: the steps i list above sound simple, but it really takes time to figure out all the problems when you run into sth that you feel it's supposed not to be. most of time it's because of chinese character problem. anybody interested in this small script could ask for it by email.

As test for html and figure posting, I insert a home link here:)

 
Comments: Post a Comment

<< Home
(Sometimes lost, but content after all) 写程序有时候可以让人着迷到废寝忘食,即便无利可图,也乐此不疲。Happy coding重在happy,而happy的不是coding本身,而是倾注创意实现灵感的点点滴滴 ……

My Photo
Name:
Location: Singapore
ARCHIVES
June 2004 / November 2004 / December 2004 / January 2005 / March 2005 / April 2005 /


Powered by Blogger