mmp

The mini music player, an alternative to MPD

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

 1(import [protocol [commands]]
 2        [protocol.util :as util])
 3(require [hy.contrib.walk [let]])
 4
 5;; TODO: Implement random and consume
 6
 7(with-decorator (commands.add "single")
 8  (defn single [ctx args]
 9    (let [arg (first args)]
10      (if (= arg "oneshot")
11        (raise (NotImplementedError "oneshot mode not supported")))
12      (with (playlist ctx.playback)
13        (assoc (. playlist mode) :single
14               (cond
15                 [(= arg "1") True]
16                 [(= arg "0") False]
17                 [True (raise (ValueError "unexpected repeat argument"))]))))))
18
19(with-decorator (commands.add "repeat")
20  (defn repeat [ctx args]
21    (with (playlist ctx.playback)
22      (assoc (. playlist mode) :repeat (first args))
23      None)))