about summary refs log tree commit diff stats
path: root/src/lib.fnl
blob: de7bf311839c391f2f150dfeea3ebdeab70aabb2 (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
;;; LIB.fnl
;; Radish library

(local util (require :util))
(local pls (require :pls))
(local mpv (require :mpv))

(local protocols {:http (fn [url]
                          (mpv.play))
                  :https :find
                  :shuf :noise})

(local radish-config (.. (or (os.getenv :XDG_CONFIG_HOME)
                             (.. (os.getenv :HOME) :/.config))
                         :/radish/stations))

(local radish-pid :/tmp/radish.pid)
(local radish-lp (.. (or (os.getenv :XDG_CACHE_HOME)
                         (.. (os.getenv :HOME) :/.cache))
                     :/radish.lastplayed))

(local radish-status :/tmp/radish.status)

(fn play [?station]
  "Begin playing STATION.
STATION can be a stream using one of `protocols', which see.  If it's not
present, or if STATION doesn't match a protocol in `protocols', allow the user
to choose one from their favorites.")

(fn kill []
  "Kill the current invocation of `radish'."
  (let [pid ()]))

(fn add [?station]
  (print :add))

(fn del [?station]
  (print :del))

(fn edit [?station]
  (print :edit))

{: play : kill : add : del : edit}