#!/bin/bash
#                        /usr/local/bin/kaqa
# https://crystalfaeries.net/audio/kkcr/kaqa
# celeste:crystalfaery KAQA 2017-07-26 20:03:44+00:00
# for installation instructions see:
# https://crystalfaeries.net/audio/kkcr/kkcr
# Play all KKCR / KAQA shows archived by celeste:crystalfaery, then go live.

# Fetch the current playlist:
cp /dev/null	~/.kkcr.m3u	|| exit -1	# can't write user's home directory?
wget -O		~/.kkcr.m3u	http://crystalfaeries.net/audio/kkcr/kkcr.m3u	|| \
echo	"${?} error in ${0} while fetching playlist via wget."	>&2		&& \
echo	"http://s1.phx.icastcenter.com/tunein/kkcr.pls"		>>		   \
		~/.kkcr.m3u	# go live at the end of archive or upon fetch failure

# Now play from the list of URLs:
mplayer	 `cat	~/.kkcr.m3u`
# return any error code from mplayer


syntax highlighted by Code2HTML, v. 0.9.1