- Put this script in your path
- Install
dmenu
&mplayer
- Run via
$> radio-di.sh
Last active
November 1, 2017 11:29
-
-
Save albertmatyi/6a2e33be0e7fa62f8bb32c297eeaef5d to your computer and use it in GitHub Desktop.
Select and listen to a radio station from Digitally Imported with mplayer & dmenu
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 -xe | |
# stop previous mplayer | |
pkill mplayer || true | |
# use either the first script parameter or a default digitally imported playlist | |
PLAYLIST_URL=${1:-https://gist.githubusercontent.com/sim642/4f73e3e145fd1eac8c39/raw/43dbe82623404c0f549a7391b5a618f5fd89f4dc/DI.m3u} | |
# get the content and let the user | |
STATION_URLS=$(curl $PLAYLIST_URL | grep http) | |
# select one station using dmenu (simple UI based filtering) | |
STATION_URL=$(printf "$STATION_URLS" | dmenu) | |
# start player and display notification on track change | |
mplayer $STATION_URL \ | |
| grep --line-buffered -Eo StreamTitle.* \ | |
| grep --line-buffered -Eo "'[^']*'" \ | |
| xargs -L 1 notify-send |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment