diff options
author | Rasmus Steinke <rasi@xssn.at> | 2014-10-28 20:01:42 +0100 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2014-10-28 20:01:42 +0100 |
commit | 480ae4a52005bbcdbead30d62f8a1adf154c5cf1 (patch) | |
tree | 4f522f9b7001facbc4b27097ae6a6994dce474ce | |
parent | 4196cb2cdf297a78091e5a608c01b82c8bd00e84 (diff) | |
download | perl-app-clerk-480ae4a52005bbcdbead30d62f8a1adf154c5cf1.tar.gz perl-app-clerk-480ae4a52005bbcdbead30d62f8a1adf154c5cf1.tar.xz |
simplify add random function
-rwxr-xr-x | clerk | 28 | ||||
-rw-r--r-- | create_rating.sql | 8 |
2 files changed, 8 insertions, 28 deletions
@@ -726,31 +726,19 @@ playRandomAlbum () { } playRandomTracks () { - addRandomT () { + 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 - } - mpc clear - addRandomT - mpc play - - nThreads=4 - - for (( i=0, j=1; i<value - 1; i++, j++ )); do - { - addRandomT - } & - - if [ $j -eq $nThreads ]; then - j=0 - wait - #sleep 1 - fi done - - wait mpc play } diff --git a/create_rating.sql b/create_rating.sql deleted file mode 100644 index f2d112e..0000000 --- a/create_rating.sql +++ /dev/null @@ -1,8 +0,0 @@ -create table if not exists albums( - date varchar(12) not null, - artist varchar(255) not null, - album varchar(255) not null, - rating smallint not null -); -create index if not exists album_ratings_idx ON albums (rating); -CREATE UNIQUE INDEX albums_dir_idx ON albums (album); |