dotfiles

Dash Eclipse's dotfiles
git clone git://ezup.dev/dotfiles.git
Log | Files | Refs | README | LICENSE

play-radio (1422B)


      1#!/bin/sh
      2
      3: "${progname:="${0##*/}"}"
      4
      5play_alt987() {
      6	# https://alt987fm.iheart.com/
      7	local STREAM_HLS='https://stream.revma.ihrhls.com/zc201/hls.m3u8'
      8	#local STREAM_SHOUTCAST='https://stream.revma.ihrhls.com/zc201'
      9	local COVER_ART='http://i.iheart.com/v3/re/assets/images/08e927dc-5949-41d6-972b-b5581a0850f3.png'
     10	proxychains4 mpv \
     11		--volume=60 \
     12		--vid=1 \
     13		--external-file="$COVER_ART" \
     14		"$STREAM_HLS"
     15}
     16
     17play_ezup() {
     18	# ezup.dev
     19	proxychains4 mpv \
     20		--volume=60 \
     21		--window-scale=0.5 \
     22		'http://45.32.163.153:10100'
     23}
     24
     25play_synthwave() {
     26	proxychains4 mpv \
     27		--vid=1 \
     28		--volume=60 \
     29		--image-display-duration=inf \
     30		'https://nightride.fm/stream/nightride.m4a'
     31}
     32
     33usage() {
     34	cat <<_EOF
     35Usage: $progname alt|ezup|synthwave	play radio
     36       $progname -k			stop playing
     37
     38_EOF
     39	exit 1
     40}
     41
     42stop_playing() {
     43	local ALL_PID=$(pidof -x $progname)
     44	local SELF_PID=$(cut -d' ' -f4 /proc/self/stat)
     45	local OTHER_PID=$(echo "$ALL_PID" | sed "s/$SELF_PID//")
     46	echo "Killing: $OTHER_PID"
     47	pkill -P $OTHER_PID
     48	exit 0
     49}
     50
     51[ "$1" = "-k" ] && stop_playing
     52
     53pidof mpv >/dev/null 2>&1 && { printf "Found running process of mpv!\n\n"; usage; }
     54test "$(pidof -x $progname)" != "$(cut -d' ' -f4 /proc/self/stat)" && { printf "Found running process of ${progname}!\n\n"; usage; }
     55
     56[ -z $1 ] && usage
     57case "$1" in
     58	alt		)	play_alt987				;;
     59	ezup		)	play_ezup				;;
     60	synthwave	)	play_synthwave				;;
     61	*		)	usage					;;
     62esac