Echo Area

Avandu in Lua

27 June 2014 11:57 PM (lua | ttrss | avandu | avandu-lua | projects)

A little while ago I started using the Awesome window manager again. I���ve started to play some PC games (such as Rogue Legacy) and have to use some more graphical applications again. Stumpwm just wasn���t quite cutting it and suddenly it seemed that my workflow didn���t quite fit with a completely-manual tiling experience.

So now that I���m back with Awesome I wanted to have a count of the number of unread articles in Tiny Tiny RSS in my wibox. I already have a project named avandu, which is an Emacs interface for Tiny Tiny RSS, and for a little while I used that in combination with Emacs��� daemon mode to get the number of unread RSS items. This halt my Emacs for a few seconds every minute, though, so that was unpleasant. It also caused a lot of ���Connecting to host: …��� messages to appear in my Emacs��� echo area, which is a little annoying.

So I decided to write a lua module to get this count, since I didn���t have a lua project yet. That is avandu-lua. Right now it only implements a login and unread functions, which allow you to log-in to get a session key (so you can do other things), and get the number of unread articles (what a shock!).

I���ve written a bit of documentation for it, hosted by github. There isn���t much to document of course, but I try.

I still need to add tests, but I���m having difficulty deciding on how to do this. busted looks really nice, but their idea of stubs and mocks doesn���t seem to be very useful if you���re testing a function that calls, for example, http.call, which returns 4 distinct values, not none. I can���t decide if I should keep looking, (try to) write something or use _TEST checks everywhere. I���m leaning towards that last one, perhaps I���ll add that.

I don���t currently have any concrete plans of extending it to have more functions than the ones I���ve added so far, I might do it for fun at some point, or if you���d really like to be able to call Tiny Tiny RSS from lua let me know and I might put some more effort into it.

It���s been nice to work with lua. I don���t particularly love the language and it certainly doesn���t beat Lisp on any front, but it has its moments and niceties.

Some things that still need to be done:

  • As I said, I need to add tests.

  • I think I should try to see if coroutines can be used, it seems to hang Awesome now on occasion.

  • Add license info. Yeah I really should almost do this before I do anything else when I start a new project. It���s going to be LLGPL in any case.

  • Release an actual version. Always installing from just a git checkout can be a little annoying.

Comments are closed.