summaryrefslogtreecommitdiffstats
path: root/avandu-in-lua.post
blob: 18fb3283674f44d73fbf0ba80a40ea6fd96b6972 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
;;;;;
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: -->