mmp

The mini music player, an alternative to MPD

git clone https://git.8pit.net/mmp.git

 1(import [protocol [commands]]
 2  [mpd.exceptions [*]])
 3(require [hy.extra.anaphoric [*]]
 4  [hy.contrib.walk [let]])
 5
 6(with-decorator (commands.add "next")
 7  (defn next [ctx args]
 8    (.next (. ctx playback))))
 9
10(with-decorator (commands.add "pause")
11  (defn pause [ctx args]
12    (if args
13      (if (first args)
14        (.pause ctx.playback)
15        (.play ctx.playback))
16      (raise (NotImplementedError "Pause command without argument")))))
17
18(with-decorator (commands.add "play")
19  (defn play [ctx args]
20    (if args
21      (try
22        (ctx.playback.play (first args))
23        (except [e IndexError]
24          (raise MPDBadIndexError)))
25      (ctx.playback.play))
26    None))
27
28(with-decorator (commands.add "stop")
29  (defn stop [ctx args]
30    (.stop (. ctx playback))))