diff options
Diffstat (limited to 'playall')
-rwxr-xr-x | playall | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#!/usr/local/bin/scsh -s +!# +;;; playall --- Play everything in my music collection in random order + +;;; Commentary: + +;; Uses `systemctl' to determine if MPD is active, and if so uses +;; `mpc' to clear the current playlist, add all the songs in MPD's +;; database to the current playlist, shuffle it and then start +;; playing. + +;;; Code: + +(define mpd-state + (let ((raw-state + (run/string (systemctl --no-pager -p ActiveState show mpd)))) + (substring raw-state + (+ (string-index raw-state #\=) 1) ; After the `=' + (- (string-length raw-state) 1)))) ; Before the `\n' + +(if (string<> mpd-state "active") + (begin + (format + #t "MPD is not active, state is reported as \"~a\".~%" mpd-state) + (exit 1))) + +(run (mpc clear)) +(fork/pipe (lambda () (run (mpc listall)))) +(&& (mpc add) + (mpc shuffle) + (mpc play)) + +;; Local Variables: +;; mode: scheme +;; End: |