diff --git a/dotfiles-old/bin/music b/dotfiles-old/bin/music new file mode 100755 index 0000000..8c91b6e --- /dev/null +++ b/dotfiles-old/bin/music @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +# DistroTube's dm-radio fixed and in POSIX shell + +alias nonzero="test -n" + +nonzero "$MUSIC_PLAYER" || MUSIC_PLAYER=mpv +nonzero "$DMENU" || DMENU=dmenu + +# tab delimits name from URL +STATIONS="\ +50s Rewind https://zeno.fm/radio/50s-rewind/ +60s Rewind https://zeno.fm/radio/60s-rewind/ +70s Rewind https://zeno.fm/radio/70s-rewind/ +80s Rewind https://zeno.fm/radio/80s-rewind/ +90s Rock https://zeno.fm/radio/90s-rock/ +The 2000s https://zeno.fm/radio/the-2000s/ +Classical Radio https://zeno.fm/radio/classical-radio/ +Classical Relaxation https://zeno.fm/radio/radio-christmas-non-stop-classical/ +Classic Rock https://zeno.fm/radio/classic-rockdnb2sav8qs8uv/ +Gangsta49 https://zeno.fm/radio/gangsta49/ +HipHop49 https://zeno.fm/radio/hiphop49/ +Madhouse Country Radio https://zeno.fm/radio/madhouse-country-radio/ +PopMusic https://zeno.fm/radio/popmusic74vyurvmug0uv/ +PopStars https://zeno.fm/radio/popstars/ +RadioMetal https://zeno.fm/radio/radio-metal/ +RocknRoll Radio https://zeno.fm/radio/rocknroll-radio994c7517qs8uv/ +Cancel nop:// +" + +selection="$(printf "%s\n" "$STATIONS" | grep -F "$(printf "%s\n" "$STATIONS" | cut -f 1 | dmenu) ")" + +if [ "$selection" = "Cancel nop://" ] +then exit 0 +fi + +pkill -f http || printf "%s: mpv not running.\n" "$0" 1>&2 +printf "%s\n" "$selection" | cut -f 2 | xargs mpv