about summary refs log tree commit diff stats
path: root/src/lib.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.fnl')
-rw-r--r--src/lib.fnl44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/lib.fnl b/src/lib.fnl new file mode 100644 index 0000000..de7bf31 --- /dev/null +++ b/src/lib.fnl
@@ -0,0 +1,44 @@
1;;; LIB.fnl
2;; Radish library
3
4(local util (require :util))
5(local pls (require :pls))
6(local mpv (require :mpv))
7
8(local protocols {:http (fn [url]
9 (mpv.play))
10 :https :find
11 :shuf :noise})
12
13(local radish-config (.. (or (os.getenv :XDG_CONFIG_HOME)
14 (.. (os.getenv :HOME) :/.config))
15 :/radish/stations))
16
17(local radish-pid :/tmp/radish.pid)
18(local radish-lp (.. (or (os.getenv :XDG_CACHE_HOME)
19 (.. (os.getenv :HOME) :/.cache))
20 :/radish.lastplayed))
21
22(local radish-status :/tmp/radish.status)
23
24(fn play [?station]
25 "Begin playing STATION.
26STATION can be a stream using one of `protocols', which see. If it's not
27present, or if STATION doesn't match a protocol in `protocols', allow the user
28to choose one from their favorites.")
29
30(fn kill []
31 "Kill the current invocation of `radish'."
32 (let [pid ()]))
33
34(fn add [?station]
35 (print :add))
36
37(fn del [?station]
38 (print :del))
39
40(fn edit [?station]
41 (print :edit))
42
43{: play : kill : add : del : edit}
44