summaryrefslogtreecommitdiffstats
path: root/bin/rand_music
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-01-16 07:32:44 -0500
committerJesse Luehrs <doy@tozt.net>2017-01-21 06:37:31 -0500
commitdc6416f8d45f02b5ba9e38a4236c1821a4cf596e (patch)
tree3594beb07b645598574622c9a6fe4a2b5351185d /bin/rand_music
parent37136d5493410cf2f5b72184f952794f33be566e (diff)
downloadconf-dc6416f8d45f02b5ba9e38a4236c1821a4cf596e.tar.gz
conf-dc6416f8d45f02b5ba9e38a4236c1821a4cf596e.zip
split most functions out into scripts
Diffstat (limited to 'bin/rand_music')
-rwxr-xr-xbin/rand_music13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/rand_music b/bin/rand_music
new file mode 100755
index 0000000..c726bf2
--- /dev/null
+++ b/bin/rand_music
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+local db
+if [[ $1 == '--old' ]]; then
+ db=old_tracks
+ shift
+else
+ db=yearly_tracks
+fi
+lastfm_export --user doyster --dsn dbi:SQLite:${HOME}/.tracks.sqlite
+for i in $(seq 1 $([ -z "$1" ] && echo 20 || echo $1)); do
+ echo "select distinct(artist) from $db where artist not in (select distinct(artist) from weekly_tracks);" | sqlite3 ~/.tracks.sqlite | rand_line | sed "s/'/''/" | sed "s/.*/select artist, album from $db where artist = '&' group by artist, album;/" | sqlite3 ~/.tracks.sqlite | rand_line | sed 's/|/ - /'
+done