scripts

scripts
git clone git://git.wimdupont.com/scripts.git
Log | Files | Refs | README | LICENSE

commit e286a1bae19b0ac7e3d344e2a55b4841dece5a86
parent c3ee62791c04cc75cd9986e6823ab8d1dd5d3a1f
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sun,  1 May 2022 21:38:08 +0200

online radio player added

Diffstat:
MREADME.adoc | 11+++++++++++
Abin/radio | 27+++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/README.adoc b/README.adoc @@ -57,6 +57,17 @@ Only first line is mandatory for this script to be useful, usernames en URL's ca * dmenu (https://git.suckless.org/dmenu/) * xclip (https://github.com/astrand/xclip) +== ./bin/radio + +Uses dmenu to browse and play online radio stations saved in a textfile (default in ~/Desktop/radiostations). The textfile should consist of the URL and a searchname separated by a +semicolon (;) delimiter and with a new line for each new station. + +.Requires: + +* dmenu (https://git.suckless.org/dmenu/) +* urxvt (https://github.com/bookercodes/awesome-urxvt) +* mpv (https://github.com/mpv-player/mpv) + == ./bin/yt Uses mpv and youtube-dl to easily look up videos from command-line with an audio-only option and an option to specify the amount of results. diff --git a/bin/radio b/bin/radio @@ -0,0 +1,27 @@ +#!/bin/bash + + +shopt -s nullglob globstar + +font=$DMENU_FONT +lines=$DMENU_LINES + +dmenu=dmenu +file=~/Desktop/radiostations + +readarray -t stations < "$file" + +stationName=$(printf '%s\n' "${stations[@]}" | cut -f2 -d ';' | "$dmenu" -fn "$font" -l "$lines" "$@") + + +for i in "${stations[@]}" +do + name=$(echo "$i" | cut -f2 -d ';') + + if [[ $name == $stationName ]]; then + station=$(echo "$i" | cut -f1 -d ';') + exec urxvt -e mpv $station + break + fi + echo "No valid station given" +done