From e8663e731b01500f3dd80563eea0d5f62a96060b Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Sat, 16 Aug 2014 10:33:28 +0200 Subject: hopefully made random rated tracks function more random --- clerk | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'clerk') diff --git a/clerk b/clerk index b27fc21..f2dddc3 100755 --- a/clerk +++ b/clerk @@ -676,7 +676,18 @@ loadRandomRatedTracks () { number="$(echo " " | dmenu_t -p "Number of Songs > " | xargs echo)" ratings_min="$(echo " " | dmenu_t -p "Minimum Rating > " | xargs echo)" ratings_max="$(echo " " | dmenu_t -p "Maximum Rating > " | xargs echo)" - for ((i="$ratings_min"; i<="$ratings_max"; i++)); do mpc find comment "$i" | shuf | head -n "$number" | mpc add; done + mpc clear + n=0; while (( n++ < $number )); + do + comment=$(for ((i="$ratings_min"; i<="$ratings_max"; i++)); do echo "$i"; done | shuf -n1) + artist=$(mpc list artist comment "$comment" | shuf -n1) + title=$(mpc list title artist "$artist" comment "$comment" | shuf -n1) + mpc findadd artist "$artist" comment "$comment" title "$title" + done + mpc play +# rating=$(for ((i="$ratings_min"; i<="$ratings_max"; i++)); do mpc find comment "$i" | shuf -n 1) +# title=$(for ((i="$ratings_min"; i<="$ratings_max"; i++)); do mpc list title comment "$i" | shuf -n 1) +# mpc find } -- cgit v1.2.3-24-g4f1b