summaryrefslogtreecommitdiffstats
path: root/bin/rand_music
diff options
context:
space:
mode:
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