summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2014-10-24 01:26:08 +0200
committerRasmus Steinke <rasi@xssn.at>2014-10-24 01:26:08 +0200
commitb3f1b7477fa168651ca2fa7ac50e012440b38f93 (patch)
tree51996cc645dbb11d3846d1b27667b3b423fe52fd
parentd4f06b220b2fcfda572a76a0017e640891d205b4 (diff)
downloadperl-app-clerk-b3f1b7477fa168651ca2fa7ac50e012440b38f93.tar.gz
perl-app-clerk-b3f1b7477fa168651ca2fa7ac50e012440b38f93.tar.xz
outsourced threaded random to own function, removed code
-rwxr-xr-xclerk29
1 files changed, 8 insertions, 21 deletions
diff --git a/clerk b/clerk
index 3354e36..dd49874 100755
--- a/clerk
+++ b/clerk
@@ -726,21 +726,21 @@ playRandomAlbum () {
}
playRandomTracks () {
+ addRandomT () {
+ 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
- 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
+ addRandomT
mpc play
nThreads=4
for (( i=0, j=1; i<value; i++, j++ )); 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
+ addRandomT
} &
if [ $j -eq $nThreads ]; then
@@ -752,19 +752,6 @@ playRandomTracks () {
wait
mpc play
-# 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
-# done
}
addLastMod() {