Howto: Use Charm like a pro

A few weeks ago, I committed the sin of whining audibly into the Internet about the lack of a proper blogging client that didn’t have ties to the Gnome underbelly. Well, I am going to admit my mistake now, and graciously accept my double-serving of humble pie.

Because I found one that not only doesn’t require Gnome, but it runs from the command line. And you know what that means, boys and girls. That’s right, it means you don’t have any excuses any longer. Drag out your old Pentium, because it’s being recommissioned.

The main things I needed from a blogging “client,” as I called it, were the ability to manage and edit posts, publish new content, and maybe edit links or manage images. People like screenshots, you know.

Charm does two out of those three, and gives you the ability to handle the third however you want. It’s a natural for the mundane tasks of updating, editing or managing blog content.

Technically, it doesn’t do any actual editing, or at least not in the conventional sense. For that task it very wisely allows you to configure an external editor, and directs your creative efforts to the application of your choice. Charm isn’t a writing suite, it’s a nifty tool for handling the nuts and bolts.

Charm is a Python-based program, which means it’s a snap to download and use, and install. Let’s grab the newest version, which was updated only about two months ago.

wget dl.sourceforge.net/sourceforge/ljcharm/charm-1.9.0.tar.gz

Now unpack it. Feel free to put it anywhere you like.

tar xvzf charm-1.9.0.tar.gz

Believe it or not, so long as python is installed on your machine (and I’m 99 percent sure it is), you’re done. You can start using it now.

Technically. Before you go any further you should set up a configuration file, because unless you tell Charm where to go, it’s just going to smile weakly and quit. As it should.

Start a file in your home directory and call it .charmrc. Here’s the guts of my configuration file, modified only slightly, of course.

metaweb = kmandla XXXXXXXX http://kmandla.wordpress.com/xmlrpc.php
editor = nano

Charm can handle WordPress, Blogger, Moveable Type, LiveJournal and a mess of other common blog hosts. WordPress uses the metaweb indicator, so I’ve followed it with my account name and password (no, my password is not really a string of X’s) and the xmlrpc address for my blog. And really, aside from that, there’s not much setup that’s required. You can run Charm from the decompressed directory, just by triggering it through Python.

python charm

Or if you prefer a system-wide installation, you can install it with this command, as the root user (in other words, Ubuntunuts need a sudo before this line):

python setup.py install

From there, it’s as easy as typing “charm” at the command prompt. Which should, barring incident, give you a menu interface that looks a little like this.

As you can see, Charm has already connected to WordPress.com, signed in and is awaiting further instructions. Now I can manage the content of my blog by working through the submenus. For example, to set up this post, I first pressed P, for the blog posting menu.

Writing a new post only requires that I press the E key, which brings up nano. Remember, Charm isn’t a writing suite. It just handles the nuts and the bolts. But you should like that, since it means you can arrange to use whatever writing program you like, be it Abiword or OpenOffice or Microsoft Word running under Wine And yes, you vi-weenies can use vi too. :roll:

I used nano here, but nano’s not really very conducive to writing, is it? What would be nice is if there was a console-based program specific to writing, without too many pointless features or random, unnecessary flair. Something for just for writing.

Oh, wait. I know. …

Yes, Charm and WordGrinder go together like peas and carrots, peanut butter and jam, or chocolate and milk. There’s only one small fault in the arrangement, and it’s something WordGrinder needs to overcome: You can’t import a file from the command line with WordGrinder.

WordGrinder can open its own file format, but Charm needs to be able to spit out a command that triggers the editor and the file. Unless you find a way to make the two hold hands neatly, you might find yourself using nano or another editor as a translator.

For my own case, I write in WordGrinder, export to text or html, trigger nano in Charm and then splice (“insert”) the text file into the dummy file that Charm created. It’s not ideal and I plan to submit a feature request for WordGrinder that would smooth that over, but for the mean time it works okay.

Let’s continue. Once the text of the post is complete and saved, we should add a title — a “subject.” From the Blog Posting Menu, the S key will do that.

And we should probably add a category. Pressing C tells Charm to screen the current categories available, and offer them for your perusal.

Notice that there’s also the option for tags; I never use them, which is why mine is blank. (I don’t see a difference between tags and categories, honestly. I’ve been over the definitions many times and tags seem redundantly redundant.)

But that’s about all you need to put something online. Here’s one last look at the posting menu before publishing.

Charm can wrangle existing posts too. From the main menu, the E key gives you the chance to screen through the posts already online or delete them completely.

Of course, if you want to edit a post from two years ago, you might prefer to do that the old fashioned way. Time spent downloading the list might be offset by the time it takes a Celeron to work its way through the WordPress.com backend. …

Charm doesn’t do some things, like allow you to rearrange blog widgets or scan your traffic stats. But again, those are shiny sparkly things that WordPress.com handles internally, and looking for them in a blog client would be stepping beyond the bounds of the original needs.

Charm has a lot of other options, and a lot of features that are aimed at different blog services. For that reason I don’t have much more of an introduction for you. The best part of Charm is this:

There it is, using up a massive zero percent of my processor time and a meager 2.4 percent of my 192Mb of memory. So roughly, 4.6Mb, which is a hair’s breadth when compared to any browser (except maybe elinks) wading through the WordPress.com blog management pages.

Now here’s the bad news.

I haven’t had much luck publishing a new post with Charm 1.9.0, because of an odd Python error that crops up. I’ve tried with Python 2.6.1 in Arch and Crux, as well as 2.5.2 in Hardy, and results are always the same. I can edit posts and follow all the other functions, but publishing a new post isn’t happening for me. It’s something that has been confirmed by other Charm users, but needs corrected. If you know any Python you might be able to accelerate the process; the bug report I filed (in the wrong section, I might add), is here. And of course, since I’m using WordPress, it might work better (or completely) on another host, or even an earlier version.

Otherwise, all Charm’s other functions work great. And I’m sufficiently pleased with Charm to use it on a regular basis, mostly because it allows me to keep using the machine I prefer for typing. Moreover I think between WordGrinder and Charm, the biggest blabbermouth on the Web would be able to keep their lips flapping and satisfy their need for affirmation from the anonymity of the Internet. And that’s what it’s all about, isn’t it? :twisted:

About these ads

28 Responses to “Howto: Use Charm like a pro”


  1. 1 reacocard 2009/01/20 at 4:26 PM

    I think I found the bug. That particular error (NameError: global name ‘datetime’ is not defined) is caused by the datetime module not being imported properly. If we go back up to the top of ljcharm.py, we see its import statement looks like this:

    try:
    import feedparser
    import httplib
    import base64
    import datetime
    import sha
    atom_ok = 1
    except:
    atom_ok = 0

    so, what its doing here is trying to import each of those modules in turn. If it gets them all, it sets a flag so it knows it got them. Otherwise, it just unsets the flag and continues merrily on its way. Problem is, if a module fails to import, none of the succeeding ones will get imported either. As feedparser is the only module here not in the python standard library, I’d rewrite it like this:

    try:
    import feedparser
    atom_ok = 1
    except:
    atom_ok = 0

    import httplib
    import base64
    import datetime
    import sha

    Now all those modules, including datetime from the error message, should get imported properly. (note: sha will give a depreciation warning) I haven’t tested this myself, but based on my knowledge of python it should work.

  2. 2 reacocard 2009/01/20 at 4:27 PM

    blarg, wordpress screwed up the indenting in my code. The revised version should have these lines indented:

    import feedparser
    atom_ok = 1
    atom_ok = 0

    all other lines should not be indented.

  3. 3 Onyros 2009/01/20 at 10:33 PM

    @ reacocard,

    It worked, mate! Brilliant! Thank you very, very much, this is perfect!

    I had used Drivel for a long time, but it was problematic, and sometimes didn’t quite work as expected. Charm works like a charm!

    Also, thank you K. for yet another great app to add to my list :D

  4. 4 Onyros 2009/01/20 at 10:36 PM

    BTW, I’m getting an error when I try to retrieve and edit something that’s already been posted, but it happened before these changes, so I’ll try reporting it “upstream” ;)

  5. 5 Onyros 2009/01/22 at 8:09 AM

    Well, I got a very quick reply from the developer, so for anyone who’s having troube editing previously posted entries – with Charm throwing out a “KeyError: ‘mt_keywords’”, this is the solution:

    Change the line that says:

    self.Params["prop_keywords"] = entry["mt_keywords"]

    to:

    if entry.has_key(“mt_keywords”):
    (indent) self.Params["prop_keywords"] = entry["mt_keywords"]

    It worked, so Charm is now my fully-endorsed desktop blogging client, and many thanks to evilhat for taking care of that so promptly, with a fix that’ll be included in Charm’s next version.

  6. 6 K.Mandla 2009/01/22 at 8:12 AM

    That’s great. :D Now I need to transfer this entire system to my Pentium, and I can at last blog in style. :P

    Thanks for all the help folks. This is how things are supposed to work! :mrgreen:

  7. 7 rpj8 2009/01/22 at 10:42 PM

    I haven’t been able to get this to work with blogger yet. Poo. Either way, I wrote an extremely simple PKGBUILD for it in aur. http://aur.archlinux.org/packages.php?ID=23359

    I’m not a big fan of just having programs floating around in my system unmanaged :).

    • 8 K.Mandla 2009/01/23 at 8:47 AM

      The bug tracker seems to be well monitored, so if you can trace it to an error you might have some luck getting a reply. Or a fix, for a future release. I believe the line-swap mentioned above is in the 1.9.1 update, but I haven’t tried it yet.

  8. 9 ikaruga 2009/01/30 at 5:51 AM

    Wow, really sweet K. Thanks for the tip. This is why I read this blog!

  9. 11 karthik 2009/02/01 at 4:56 AM

    Charm looks brilliant! Thanks a lot for the find, and for the post.

    I know you mentioned there’s an option for WordPress tags- but as far as I know, the MetaWeblog API does not offer an option to handle tag data. (I think the most it can do is to list an existing post’s tags, not create new ones.)

    So, um, any idea if the tags option works?

    The lack of tags functionality is the only gripe I have with Vimblog, and I intend to shift to Charm if it handles WP tags well.

  10. 12 K.Mandla 2009/02/01 at 7:39 AM

    I”ll be perfectly honest and say I don’t use tags, so I haven’t tried pushing them through Charm yet. Give it a try and see if it does like you want, then let us know. :)

  11. 13 karthik 2009/02/02 at 7:50 PM

    Tested- WP tags are handled like a charm.

    I’m still getting to grips with how this is managed- as per the official documentation, there is no method of obtaining or adding tags. My knowledge of Python is fairly rudimentary, so parts of the script (like the tag-handling) are a mystery to me.

    Oh, well, it works!

    Sometimes I wonder what the point of going to great lengths to find lightweight tools for use in a dual core machine (with tonnes of RAM) is, but thankfully, this phase fades quickly.

  12. 14 urukrama 2009/02/13 at 6:34 AM

    Thanks for this, K.Mandla. I’ve finally set it up on my computer and it works great.

    The difference between tags and categories, by the way, is that categories are blog specific: they help you organise the post you’ve posted on your blog. Tags on the other hand span all the blogs on WordPress. If you click on a tag, you’ll see any WordPress blog post that has those tags.

    I add tags to my own posts, but never really use them. According to the WordPress statistics, I get a lot of traffic to my blog from those tags, though.

  13. 15 FND 2009/03/29 at 1:38 AM

    Thanks a lot for this!
    I’d tested GNOME blog before, but that didn’t really satisfy my needs. Charms seems just right, and gets the command-line bonus!

  14. 16 arun 2009/09/28 at 3:39 PM

    Thanks, this is very useful :)

  15. 17 Nathan Grubb 2009/10/07 at 9:16 PM

    Wow, I just tried it. I like it more than the wordpress interface, but it’s annoying that nano doesn’t wrap lines (perhaps I’ll use another editor, I chose nano for simplicity since I didn’t want to insert a random x in my post like I frequently do with emacs, or a :wq with Vim)

  16. 18 Andy 2010/04/20 at 5:55 PM

    Has anyone got this to work with blogger? I’ve seen that it uses code that says (“www.blogger.com”, “/atom/”, 1) in it’s ljcharm.py module.

    But with a webadress like mindofmoney.blogspot.com, there is no /atom in the link, causing it to fail. It doesn’t find the page. I tried removing the atom part in the code, but then it gives some code that the page temporarily moved.

    People seem to be using it though, so maybe someone else here has any experience with charm + blogger? :)

  17. 19 PeterStJ 2010/11/29 at 2:29 AM

    Nice little application, however it misses one very important (imo) option – search text in previous entries (as taken from logjam – gtk livejournal blog application) that has prooved to be very usedful. Actually I start it (logjam) only when I need to search text in my blog and I do my editing in vim with some python scripts to communicate with livejournal server. It does the trick by archiving the whole blog locally as sqlite DB and perform the search locally on the data. Thus it does not rely on google or other search engine to look for your search term in your own blog.


  1. 1 Case in point: Charm at 100Mhz 16Mb « Motho ke motho ka botho Trackback on 2009/01/25 at 6:09 PM
  2. 2 Settling in at 100Mhz « Motho ke motho ka botho Trackback on 2009/02/02 at 9:09 AM
  3. 3 Still looking for … « Motho ke motho ka botho Trackback on 2009/02/17 at 8:53 AM
  4. 4 » Testing GNOME Blog FND’s Blag: Just Another Personal Wobsite Trackback on 2009/03/29 at 1:43 AM
  5. 5 More console apps, for future reference « Motho ke motho ka botho Trackback on 2009/05/05 at 8:28 AM
  6. 6 Desktop Blogging Client For Linux « L3ftm1n0r Trackback on 2009/07/28 at 11:20 PM
  7. 7 A Crux port (and patch) for Charm « Motho ke motho ka botho Trackback on 2009/08/14 at 9:58 PM
  8. 8 charm test « Disparaging Thoughts Trackback on 2010/02/15 at 4:11 PM
  9. 9 Taking Puppeee out for a walk « Andy C.'s weblog Trackback on 2010/10/29 at 1:34 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,959,559 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: