From d4f06b220b2fcfda572a76a0017e640891d205b4 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Fri, 24 Oct 2014 01:15:43 +0200 Subject: threaded adding of random tracks --- clerk | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/clerk b/clerk index 3dc4af6..3354e36 100755 --- a/clerk +++ b/clerk @@ -732,13 +732,39 @@ playRandomTracks () { 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 + + nThreads=4 + + for (( i=0, j=1; i