diff options
Diffstat (limited to 'clerk')
-rwxr-xr-x | clerk | 38 |
1 files changed, 32 insertions, 6 deletions
@@ -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<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 + } & + + if [ $j -eq $nThreads ]; then + j=0 + wait + #sleep 1 + fi done + + 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() { |