If you are thinking what the heck a .sh and Python? Well, b.sh is the project name and the main script is a python script. I know its confusing, but the project was started with a shell script until I hit a ridiculous rock of Blogger GData API a month ago. I will explain more history later, in case Ive bored you.


As of 2013-02-02T12:16:01Z, b.sh has been renamed to b.py. Its too confusing, even for me. Also, its on PyPI now.

1   Purpose

To simply put it, itd be

publishing (technical) posts to Blogger in your favorite markup language seamlessly without much fuss.

As this post title says, b.sh (b.py) is a Python script to enable a Blogger blogger to blog from command-line. As a matter of fact, I am writing this post in Vim and posting it directly from Vim with my defined key-mapping, and have been doing so since the end of 2012. I dont even actually go to command-line to type the command, of course I can if I need to.

b.sh can post or update a blog post currently with reStructuredText and Markdown markup language support, that is, with an example, you can:

$ b.py post myblogpost.rst
# or
$ b.py post myblogpost.mkd

Then the post is published. To update, run exactly same command again, the post ID and related meta-data will automatically be stored within the markup source file.

2   What can it do now?

It supports Python 2.7 on Linux, with markup handlers, Markdown and reStructuredText, and can also specify title, labels in header, or generate HTML for preview.

3   History

It all started with my-rst2html.py, which is the base of b.pys reStructuredText handler, when I first switched to reStructuredText from Markdown. I wrote it to generate my own HTML for posting. That was August, 2011. I had been copy-and-pasting for many years since posting in Markdown, thats tedious task, I must say.

A month ago, I was very tired of having to paste manually and worrying Blogger would still mess up the HTML, I began writing a shell script b.sh, which allowed me to post via GoogleCL. Unfortunately, I had to drop it because of a bug in API, even I asked for a fix on Blogger Developer Forums, they didnt seem to care.

So, I was forced to move on to API v3.

Note that GData v2 has not yet been deprecated and v3 has not yet completedno page or draft support, so you know how I feel towards Bloggers support and their views on their own API. In fact, v3 is still in experimental stage in my opinion. If you want to use it you need to request quota and wait for approval, not like other Google APIs, you just slide the switch and agree the term in API console, then you are good to go.

Right now, I can post without problems in Vim, its fine with me.

4   Future of b.sh

I am still waiting Blogger to add support for pages and draft control. I have held up updating my pages since I wrote b.py, would love to update page in Vim.

When I created b.sh on Bitbucket a month ago, I wish this could support on different systems and markup languages someday. So, I made it possible to add your own markup language handler alongside your blog posts, see Writing a custom handler, you dont need to wait for my support or if you dont like the handlers in b.sh, you can just override it.

I wish b.sh can help bloggers like me who prefer to use as much command-line as possible. To be flank, Bloggers WYSIWYG/HTML editor is one thing I hate most about Blogger, and thats the motivation why I created b.sh, so I can avoid it.

But I have no intention to see b.sh only be useful for command-line use, as long as an editor with external command support like Vim or any GUI editor, I believe b.sh can work well.

CLI lover, markup language user, and Blogger blogger? Go try b.sh out.