git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/mio/bin
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/mio/bin')
-rwxr-xr-xansible/mio/bin/mio15
1 files changed, 15 insertions, 0 deletions
diff --git a/ansible/mio/bin/mio b/ansible/mio/bin/mio
new file mode 100755
index 0000000..1362c8c
--- /dev/null
+++ b/ansible/mio/bin/mio
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+YOUTUBE="https://www.youtube.com/watch?v="
+MYTGT="/tmp/mio"
+MYMIOCOLL="/var/lib/mio/mio.lst"
+
+rm -vf "$MYTGT"*
+
+MYLINES="$(wc -l "$MYMIOCOLL"|awk '{print $1}')"
+MYMIO="$(head -n "$((RANDOM%$MYLINES+1))" "$MYMIOCOLL"|tail -n1)"
+unset MYLINES MYMIOCOLL
+MYMIOTUBE="${YOUTUBE}${MYMIO}"
+unset MYMIO
+#echo "$MYMIOTUBE"
+youtube-dl --write-description --write-info-json -o "/tmp/mio.%(ext)s" "$MYMIOTUBE"