summaryrefslogtreecommitdiffstats
path: root/clerk
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2014-08-16 10:33:28 +0200
committerRasmus Steinke <rasi@xssn.at>2014-08-16 10:33:28 +0200
commite8663e731b01500f3dd80563eea0d5f62a96060b (patch)
tree97ece1401e212d883cbadac67856050fb10e8f5b /clerk
parentc0890e561e7818bb39cecc8bf3ae65c310283009 (diff)
downloadperl-app-clerk-e8663e731b01500f3dd80563eea0d5f62a96060b.tar.gz
perl-app-clerk-e8663e731b01500f3dd80563eea0d5f62a96060b.tar.xz
hopefully made random rated tracks function more random
Diffstat (limited to 'clerk')
-rwxr-xr-xclerk13
1 files changed, 12 insertions, 1 deletions
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
}