Created
July 16, 2018 14:09
-
-
Save danrouse/59de65902e5c1852201c22f44857d104 to your computer and use it in GitHub Desktop.
di.fm auto completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function di_fm_channels() { | |
curl -s https://www.di.fm/channels 2>&1 | grep di.app.start | sed 's/\s*di.app.start(//; s/);\s*$//' | jq -r .channels[].key | |
} | |
if [ ! -f /tmp/di_fm_channels ]; then | |
di_fm_channels | tr '\n' ' ' > /tmp/di_fm_channels | |
fi | |
function di_fm_random_channel() { | |
cat /tmp/di_fm_channels | sort -R | head -n1 | |
} | |
function di_fm() { | |
CHANNEL=$1 | |
# open a random channel if none specified | |
if [ -z "$CHANNEL"]; then CHANNEL=`di_fm_random_channel`; fi | |
open "https://www.di.fm/$CHANNEL" | |
} | |
complete -W "$(cat /tmp/di_fm_channels | tr '\n' ' ')" di_fm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10:05:32 ~$ di_fm | |
00sclubhits classiceurodisco downtempolounge eurodance idm nudisco trance | |
ambient classictechno drumandbass funkyhouse indiebeats oldschoolacid trap | |
atmosphericbreaks classictrance drumstep futurebass indiedance oldschoolhouse tribalhouse | |
bassline classicvocaltrance dub futuregarage jazzhouse oldschoolrave umfradio | |
bassnjackinhouse club dubstep futuresynthpop jungle progressive undergroundtechno | |
bigbeat clubdubstep dubtechno gabber latinhouse progressivepsy vocalchillout | |
bigroomhouse darkdnb ebm glitchhop liquiddnb psybient vocallounge | |
breaks darkpsytrance eclectronica goapsy liquiddubstep psychill vocaltrance | |
chillhop deephouse electro handsup liquidtrap russianclubhits | |
chillntropicalhouse deepnudisco electronicpioneers hardcore lounge soulfulhouse | |
chillout deeptech electronics harddance mainstage spacemusic | |
chilloutdreams detroithousentechno electropop hardstyle melodicprogressive synthwave | |
chillstep discohouse electroswing hardtechno minimal techhouse | |
classiceurodance djmixes epictrance house nightcore techno | |
10:05:32 ~$ di_fm electro | |
electro electronicpioneers electronics electropop electroswing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment