If the program works, then this is my first published post using a python program I’m working on and, for now, call blogtools. Now that I’ve been posting for awhile, I’ve got a decent idea for what I need in a blog client- not that much. The fact is that I don’t do a lot of fancy visual stuff ’round these parts. Every now and again, I include a piece of code, or a quote, and use some “pre” tags to do that. Even more infrequently, I put some pictures in a post.
So an honest appraisal is that all I really need is a text editor for writing a post and a way to get the post to the blog. Well, we’ve got xmlrpc for the latter. For the former, if there’s one thing that Linux accels at, it is providing ways to write text files: vim, emacs, nano, ed to name a few.
So given that, I figured a little piece of code that could process a text file was all I really needed for my blogging purposes. Besides, it seemed like a nice chance to write some code. After monkeying around with the xmlrpc lib in python, I started giving some thought as to how exactly I’d support the functionality I wanted.
My first choice was to create a header section containing all the configuration required for publishing a post. I figured that some kind of “rc” config file would also be required because certain things like the blog name, username and password stuff would get tiresome to enter everytime I wanted to publish a post. Lastly, some kind of simple markup so capability in the text region would also be nice so that I could place pictures and links in the post. For most of that, I think markdown is completely appropriate. The only part markdown doesn’t look like it will handle are the attributes for an image. I’m sure I can figure out something there as well.
The header section consists of keywords followed by operators and values. The operators determine how the value is assigned to the keyword. The keywords are real imaginative stuff like TITLE, BLOG, NAME, XMLRPC, CATEGORIES, POSTID, USERNAME, PASSWORD and TAGS. Keywords are all uppercase. The operators indicate whether a single value is being assigned, a list of values are being assigned, or a group is being defined. The group operator allows for certain attributes to be associated with a keyword. For now, the BLOG keyword is the only one that a group operator has an use for. The idea here is to support posting to multiple blogs and the header gives the flexibility to make subtle changes when publishing the same post to multiple blogs. The simplest exaple of this is different category lists.
The operators are ‘:’, ‘[]’ and ‘{}’. Again, nothing too imaginative here. The colon is for single values (TITLE, for example), the square brackets create a list (CATEGORIES for example), and the braces create a group (BLOG for example). Keywords in groups take precedence over the same keyword assigned outside the group.
Other details I’ve considered. When a post is successfully pulished, the postid will be added to the header section of the file so that subsequent postings of the file will be treated as editing the file. I’ll provide a means to get a category list from a blog. I think ultimately I’ll also provide a way to pull comments from the blog as well. A means to schedule posts by providing a configurable data field would be nice as well. Automatic image uploading and link-resolving for the uploaded image will be done.
UPDATE: The update was a chance to test the post editing functionality. Basically, a POSTID in the header is handled and the post will be updated. I also determined that I had to make newline characters significant in the grammar. Any single value MUST be terminated with a newline. This was the simplest way to make sure everythin is parsable. Otherwise, I would have needed quotes or something else entirely. I did not want to do something else entirely so the choice was easy.