Content tagged ttrss

Avandu in Lua

Published on:

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.


This blog covers archlinux, avandu, avandu-lua, cask, ci, clark, common-lisp, config, conkeror, diff, dispass, dispass.el, editors, elisp, emacs, eshell, evil, exherbo, experiments, file-synchronization, games, git, github, gnus, hla, html, javascript, lisp, lua, markam, meta, mpd, notion, org-mode, ox-coleslaw, projects, rc, sbcl, small-recent-posts, software, stumpwm, systemd, tasks, tekuti, testing, tips, todo, ttrss, utility, vagrant, vc, vim, visual, wdocker docker docker-compose, wm, wordpress, yoshi-theme

View content from 2016-02, 2015-09, 2015-08, 2014-12, 2014-10, 2014-08, 2014-07, 2014-06, 2014-04, 2014-01, 2013-11, 2013-10, 2013-08, 2013-05, 2013-04, 2013-02, 2013-01