2022-03-03 07:04:01 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
# -*- mode: scheme; -*-
|
|
|
|
IFS=" "
|
2022-03-03 10:08:16 +01:00
|
|
|
exec scsh -ll mpd.scm -o mpd -s "$0" "$@"
|
2016-09-18 00:03:16 +02:00
|
|
|
!#
|
|
|
|
|
2022-03-03 07:04:01 +01:00
|
|
|
(define (randomize-all-albums)
|
|
|
|
(for-each (lambda (album)
|
|
|
|
(run (mpc findadd album ,album)))
|
|
|
|
(run/strings (pipe (mpc list album)
|
|
|
|
(shuf)))))
|
2016-09-18 00:03:16 +02:00
|
|
|
|
2022-03-03 07:04:01 +01:00
|
|
|
(define (randomize-albums-by-artist artist)
|
|
|
|
(for-each (lambda (album)
|
2022-03-03 10:08:16 +01:00
|
|
|
(run (mpc findadd ,(query (and (= artist ,artist)
|
|
|
|
(= album ,album))))))
|
|
|
|
(run/strings (pipe (mpc list album ,(query (= artist ,artist)))
|
2022-03-03 07:04:01 +01:00
|
|
|
(shuf)))))
|
|
|
|
|
|
|
|
(run (mpc clear)
|
|
|
|
(> /dev/null))
|
|
|
|
|
|
|
|
(if (> (length command-line-arguments) 0)
|
|
|
|
(randomize-albums-by-artist (car command-line-arguments))
|
|
|
|
(randomize-all-albums))
|