dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit 9edb834558cd5ff3d5a36bcc0b20668844abc234
parent 307a116679c7d7296d9f375a764e1164f2561705
Author: Chris Noxz <chris@noxz.tech>
Date:   Thu, 16 Jan 2020 17:25:58 +0100

[bin] Add all di.fm providers

Diffstat:
Dbin/.bin/dmenu_di.fm | 40----------------------------------------
Mbin/.bin/dmenu_main | 6+++---
Abin/.bin/dmenu_radio | 46++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/bin/.bin/dmenu_di.fm b/bin/.bin/dmenu_di.fm @@ -1,40 +0,0 @@ -#!/bin/sh - -choice="" -data="" -key="$1"; shift -options="" -args=" $@" - -[ "$key" = "" ] && exit 1 - -# download list of available channels -data="$( - curl -s "http://listen.di.fm/premium_high/" \ - | grep -Po "http://listen.*?pls" \ -)" -options="$( - echo $data \ - | tr ' ' '\n' \ - | sed 's/^.*\/premium_high\/\(.*\).pls/\1/g' \ -)" - -# get url based on choice -choice=$(printf "$options" | sort | dmenu_vtc${args}) -choice=$(printf "$data" | grep "/$choice.pls") -choice="${choice##*\ }" - -# exit if no station was picked -[ "$choice" = "" ] && exit 0 - -# make tmp -tmp="$(mktemp /tmp/pls.XXXXXXXXXX)" && chmod 600 "$tmp" || exit 1 - -# download channel playlist -curl -s "$choice" | sed "s/\(File[0-9].*$\)/\1?$key/g" > "$tmp" - -# load playlist -mpvc load "$tmp" - -# remove playlist after 60 seconds -sleep 60 && rm "$tmp" diff --git a/bin/.bin/dmenu_main b/bin/.bin/dmenu_main @@ -3,7 +3,7 @@ args=" -p main: -l 20" options=" bookmarks - di.fm + radio man operations pass @@ -31,8 +31,8 @@ case "$(printf "$options" \ | dmenu_vtc${args})" in bookmarks) dmenu_bookmarks "$HOME/.data/bookmarks" ${args} -i -p bookmark:;; -di.fm) - dmenu_di.fm "$(get_fm_key)" ${args} -i -p di.fm:;; +radio) + dmenu_radio "$(get_fm_key)" ${args} -i -p provider:;; man) dmenu_man${args} -i -p man:;; operations) diff --git a/bin/.bin/dmenu_radio b/bin/.bin/dmenu_radio @@ -0,0 +1,46 @@ +#!/bin/sh + +provider="" +choice="" +data="" +key="$1"; shift +options="" +args=" $@" +quality="premium_high" # premium_low, premium_medium, premium, premium_high + +[ "$key" = "" ] && exit 1 + +# choose provider +provider=$(printf "di.fm\nradiotunes.com\nrockradio.com\njazzradio.com" \ + | sort | dmenu_vtc${args}) + +# download list of available channels +data="$( + curl -s "http://listen.$provider/$quality/" \ + | grep -Po "http://listen.*?pls" \ +)" +options="$( + echo $data \ + | tr ' ' '\n' \ + | sed 's/^.*\/premium_high\/\(.*\).pls/\1/g' \ +)" + +# get url based on choice +choice=$(printf "$options" | sort | dmenu_vtc${args} -p $provider:) +choice=$(printf "$data" | grep "/$choice.pls") +choice="${choice##*\ }" + +# exit if no station was picked +[ "$choice" = "" ] && exit 0 + +# make tmp +tmp="$(mktemp /tmp/pls.XXXXXXXXXX)" && chmod 600 "$tmp" || exit 1 + +# download channel playlist +curl -s "$choice" | sed "s/\(File[0-9].*$\)/\1?$key/g" > "$tmp" + +# load playlist +mpvc load "$tmp" + +# remove playlist after 60 seconds +sleep 60 && rm "$tmp"