[mpd] Add option to randomize albums by specific artist
This commit is contained in:
parent
1b3dad4212
commit
79df03a72a
1 changed files with 21 additions and 6 deletions
|
@ -1,9 +1,24 @@
|
|||
#!/usr/bin/scsh -s
|
||||
#!/usr/bin/env sh
|
||||
# -*- mode: scheme; -*-
|
||||
IFS=" "
|
||||
exec scsh -s "$0" "$@"
|
||||
!#
|
||||
|
||||
(run (mpc clear))
|
||||
|
||||
(for-each (lambda (album)
|
||||
(define (randomize-all-albums)
|
||||
(for-each (lambda (album)
|
||||
(run (mpc findadd album ,album)))
|
||||
(run/strings (pipe (mpc list album)
|
||||
(shuf))))
|
||||
(shuf)))))
|
||||
|
||||
(define (randomize-albums-by-artist artist)
|
||||
(for-each (lambda (album)
|
||||
(display (run/string (mpc findadd ,(string-append "((artist == \"" artist "\") AND (album == \"" album "\"))")))))
|
||||
(run/strings (pipe (mpc list album ,(string-append "((artist == \"" artist "\"))"))
|
||||
(shuf)))))
|
||||
|
||||
(run (mpc clear)
|
||||
(> /dev/null))
|
||||
|
||||
(if (> (length command-line-arguments) 0)
|
||||
(randomize-albums-by-artist (car command-line-arguments))
|
||||
(randomize-all-albums))
|
||||
|
|
Loading…
Reference in a new issue