70 lines
2.9 KiB
Text
70 lines
2.9 KiB
Text
;;;;;
|
|
title: Avandu in Lua
|
|
tags: lua, ttrss, avandu, avandu-lua, projects
|
|
date: 2014-06-27 23:57
|
|
format: md
|
|
;;;;;
|
|
|
|
A little while ago I started using the
|
|
[Awesome window manager](http://awesome.naquadah.org/) again. I've
|
|
started to play some PC games (such as
|
|
[Rogue Legacy](https://ryuslash.org/blog/?p=44)) and have to use some
|
|
more graphical applications again.
|
|
[Stumpwm](http://stumpwm.nongnu.org) 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](https://github.com/ryuslash/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](http://ryuslash.github.io/avandu-lua/) 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](http://olivinelabs.com/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.
|
|
|
|
<!-- Local Variables: -->
|
|
<!-- mode: markdown -->
|
|
<!-- End: -->
|