summaryrefslogtreecommitdiffstats
path: root/clerk
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2014-10-28 20:01:42 +0100
committerRasmus Steinke <rasi@xssn.at>2014-10-28 20:01:42 +0100
commit480ae4a52005bbcdbead30d62f8a1adf154c5cf1 (patch)
tree4f522f9b7001facbc4b27097ae6a6994dce474ce /clerk
parent4196cb2cdf297a78091e5a608c01b82c8bd00e84 (diff)
downloadperl-app-clerk-480ae4a52005bbcdbead30d62f8a1adf154c5cf1.tar.gz
perl-app-clerk-480ae4a52005bbcdbead30d62f8a1adf154c5cf1.tar.xz
simplify add random function
Diffstat (limited to 'clerk')
-rwxr-xr-xclerk28
1 files changed, 8 insertions, 20 deletions
diff --git a/clerk b/clerk
index 257ec03..dc32d72 100755
--- a/clerk
+++ b/clerk
@@ -726,31 +726,19 @@ playRandomAlbum () {
}
playRandomTracks () {
- addRandomT () {
+ mpc clear
+ artist="$(mpc list "$mpd_artist" | shuf -n 1)"
+ album="$(mpc list album "$mpd_artist" "$artist" | shuf -n 1)"
+ title="$(mpc list title album "$album" "$mpd_artist" "$artist" | shuf -n 1)"
+ mpc find album "$album" "$mpd_artist" "$artist" title "$title" | mpc add
+ mpc play
+ n=0; while (( n++ < $value -1 ));
+ do
artist="$(mpc list "$mpd_artist" | shuf -n 1)"
album="$(mpc list album "$mpd_artist" "$artist" | shuf -n 1)"
title="$(mpc list title album "$album" "$mpd_artist" "$artist" | shuf -n 1)"
mpc find album "$album" "$mpd_artist" "$artist" title "$title" | mpc add
- }
- mpc clear
- addRandomT
- mpc play
-
- nThreads=4
-
- for (( i=0, j=1; i<value - 1; i++, j++ )); do
- {
- addRandomT
- } &
-
- if [ $j -eq $nThreads ]; then
- j=0
- wait
- #sleep 1
- fi
done
-
- wait
mpc play
}